This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub struct Envelope<M: Message> { | |
message: M, | |
context: SpanContext, | |
} | |
impl<M: Message> Envelope<M> { | |
pub fn new(message: M) -> Self { | |
let context = Span::current().context().span().span_context().clone(); | |
Self { message, context } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Altinn.ResourceRegistry.Persistence.Configuration; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.Logging; | |
using Testcontainers.PostgreSql; | |
using Yuniql.Core; | |
namespace Altinn.ResourceRegistry.Persistence.Tests; | |
public abstract class DbTests : IAsyncLifetime | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Node] | |
public class Foo | |
{ | |
private readonly FooDto _dto; | |
public Foo(FooDto dto) | |
=> _dto = dto; | |
// Optional attribute - this is as an alternative to use `[Node(IdField = "Id")]` - and not needed when the field is called "Id". | |
// I just think this is a better discovery mechanism than Setting an `IdField`. It's also more similar to thinks like `[Key]` etc. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index = (ulid[0] & 224) >> 5; | |
output[0] = alphabet[index]; | |
index = ulid[0] & 31; | |
output[1] = alphabet[index]; | |
index = (ulid[1] & 248) >> 3; | |
output[2] = alphabet[index]; | |
index = ((ulid[1] & 7) << 2) | ((ulid[2] & 192) >> 6); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################ | |
## BASE IMAGE | |
############################################################ | |
FROM ubuntu:latest as base | |
ARG DEBIAN_FRONTEND=noninteractive | |
RUN apt-get update && \ | |
apt-get install -y software-properties-common && \ | |
apt-add-repository universe && \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class FooBar | |
{ | |
public static string Foo { get; } = "Foo"; | |
public static string Bar { get; } = "Bar"; | |
public static IEnumerable<string> All { get; } = GetAll().ToImmutableList(); | |
static IEnumerable<string> GetAll() | |
{ | |
foreach (var prop in typeof(FooBar).GetProperties(BindingFlags.Static | BindingFlags.Public | BindingFlags.DeclaredOnly)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
k3os-17054 [~]$ k3s check-config | |
Verifying binaries in /var/lib/rancher/k3s/data/688c8ca42a6cd0c042322efea271d6f3849d3de17c850739b0da2461f6c69ee8/bin: | |
- sha256sum: good | |
- links: good | |
System: | |
- /usr/sbin iptables v1.8.3 (legacy): ok | |
- swap: disabled | |
- routes: ok |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::tag::TagLookup; | |
use git2::Repository; | |
pub struct Context { | |
// NOTE: This lifetime is fake | |
tags: TagLookup<'static>, | |
// IMPORTANT: this has to be last to be dropped last | |
repo: Box<Repository>, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait ValueCaster { | |
unsafe fn cast_to_any(&self, b: Box<dyn Value>) -> Box<dyn Any>; | |
} | |
struct BoxCaster<V: Value>(PhantomData<V>); | |
impl<V: Value> BoxCaster<V> { | |
const INSTANCE: BoxCaster<V> = BoxCaster(PhantomData); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class Extensions | |
{ | |
// Temporary workaround until https://github.com/ChilliCream/hotchocolate/issues/2522 is resolved | |
public static LocaleDirective ToLocaleDirective(this IDirectiveContext context) | |
{ | |
var node = context.Directive.ToNode(removeNullArguments: false); | |
CultureInfo culture; | |
var cultureArgument = node.Arguments.FirstOrDefault(t => t.Name.Value == "culture"); | |
switch (cultureArgument) |