Skip to content

Instantly share code, notes, and snippets.

View Alxandr's full-sized avatar
⁉️
⁉️

Aleksander Heintz Alxandr

⁉️
⁉️
View GitHub Profile
MERGE INTO register.external_role_assignment era USING (
SELECT
p_from_party from_party,
p_source "source",
a.to_party,
a.identifier
FROM
unnest(p_assignments) a
) upd ON era.from_party = upd.from_party
AND era.to_party = upd.to_party
@Alxandr
Alxandr / upsert_external_role_assignments.sql
Last active January 31, 2025 12:53
upsert_external_role_assignments
CREATE FUNCTION register.upsert_external_role_assignments(
p_from_party uuid,
p_source register.party_source,
p_cmd_id uuid,
p_assignments register.arg_upsert_external_role_assignmen[]
)
RETURNS TABLE (
"type" register.external_role_assignment_event_type NOT NULL,
"source" register.party_source NOT NULL,
identifier register.identifier NOT NULL,
animations {
bezier=easeOutQuint,0.23,1,0.32,1
bezier=easeInOutCubic,0.65,0.05,0.36,1
bezier=linear,0,0,1,1
bezier=almostLinear,0.5,0.5,0.75,1.0
bezier=quick,0.15,0,0.1,1
animation=global, 1, 10, default
animation=border, 1, 5.39, easeOutQuint
animation=windows, 1, 4.79, easeOutQuint
animation=windowsIn, 1, 4.1, easeOutQuint, popin 87%
-- Sequence register.party_version_id_seq
CREATE SEQUENCE register.party_version_id_seq AS bigint;
-- Table: register.party
-- CREATE TABLE register.party (
-- uuid uuid NOT NULL,
-- id int8 NOT NULL,
-- party_type register.party_type NOT NULL,
static PersonIdentifier GeneratePersonIdentifier(DateOnly dateComp, bool isDNumber)
{
Vector256<ushort> k1weights = Vector256.Create((ushort)3, 7, 6, 1, 8, 9, 4, 5, 2, 0, 0, 0, 0, 0, 0, 0);
Vector256<ushort> k2weights = Vector256.Create((ushort)5, 4, 3, 2, 7, 6, 5, 4, 3, 2, 0, 0, 0, 0, 0, 0);
Span<ushort> k1_candidates = stackalloc ushort[4];
var random = Random.Shared;
var dayOffset = isDNumber ? 40 : 0;
int written;
const HIGHEST_BIT_MASK: u32 = 1 << 31;
#[repr(C)]
#[derive(Portable)]
pub struct ArchivedHeaderName {
// if the highest bit is unset, this is a known header index
// else this is 10 bits of length followed by 21 bits of relative pointer
inner: u32_le,
}
@Alxandr
Alxandr / serialize.rs
Last active November 2, 2024 23:07
headers
#[repr(C)]
#[derive(Portable)]
struct ArchivedHttpResponse {
/// The body of the response.
body: ArchivedBox<[u8]>,
/// The headers of the response.
headers: ArchivedBox<[(ArchivedHeaderName, ArchivedBox<[u8]>)]>,
/// The status code of the response.
{
// not part of the resource - just here to describe what kind of resource this is about
"_description": "Resurs som delegeres i 'biter'",
"actions": null,
"subResources": {
"create": {
"type": "write", // this is an enum used to determin what kind of icon to show in the UI
"name": {
"nb": "Opprett skjema",
"en": "Create form"
[
{
"id": "order-licence-plate",
"action": "order",
"resource": {
// urn:altinn:resouce er arvet, så den skippes
"urn:svv:area": "license-plates"
},
"name": {
"no": "Bestill skilt",
{
"rights": {
"required": [
{ "...": "..." },
{ "...": "..." }
],
"unwanted": [
{ "...": "..." },
{ "...": "..." }
]