Documentation
¶
Overview ¶
Package notificationstore owns private notification persistence models. Applications use notifications' typed descriptors and recipient-scoped inbox.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Deliveries = orm.Define("foundry_notification_deliveries", func(b orm.Builder[Delivery], m *Delivery) DeliveryTable { table := orm.TableOf(b, &m.Key) field0 := orm.TextKey(table.Key()) field1 := orm.ColumnOf(b, &m.NotificationID) field2 := orm.TextOf(b, &m.Channel) field3 := orm.TextOf(b, &m.Kind) field4 := orm.TextOf(b, &m.State) field5 := orm.JSONOf(b, &m.Payload) field6 := orm.ColumnOf(b, &m.Claim) field7 := orm.NumberOf(b, &m.Attempts) field8 := orm.TimeOf(b, &m.UpdatedAt) return DeliveryTable{ Table: table, KeyColumn: field0, NotificationID: field1, Channel: field2, Kind: field3, State: field4, Payload: field5, Claim: field6, Attempts: field7, UpdatedAt: field8, } }, orm.ModelFingerprint("c276be64b6e87ea9854d37bae174c5336af7d3ae392a493db85e4d31e566ee05"))
Deliveries is the foundry_notification_deliveries table.
var Envelopes = orm.Define("foundry_notifications", func(b orm.Builder[Envelope], m *Envelope) EnvelopeTable { table := orm.TableOf(b, &m.ID) field0 := table.Key() field1 := orm.TextOf(b, &m.Recipient) field2 := orm.TextOf(b, &m.Scope) field3 := orm.TextOf(b, &m.SubjectKey) field4 := orm.JSONOf(b, &m.Identity) field5 := orm.JSONOf(b, &m.Origin) field6 := orm.TextOf(b, &m.Name) field7 := orm.NumberOf(b, &m.Version) field8 := orm.JSONOf(b, &m.Payload) field9 := orm.TextOf(b, &m.Fingerprint) field10 := orm.TimeOf(b, &m.CreatedAt) return EnvelopeTable{ Table: table, ID: field0, Recipient: field1, Scope: field2, SubjectKey: field3, Identity: field4, Origin: field5, Name: field6, Version: field7, Payload: field8, Fingerprint: field9, CreatedAt: field10, } }, orm.ModelFingerprint("cee31830c572527b5e3a943632ced25c398b609154e70454faf44a1ae504ca1d"))
Envelopes is the foundry_notifications table.
var Inboxes = orm.Define("foundry_notification_inbox", func(b orm.Builder[Inbox], m *Inbox) InboxTable { table := orm.TableOf(b, &m.ID) field0 := table.Key() field1 := orm.TextOf(b, &m.Scope) field2 := orm.TextOf(b, &m.SubjectKey) field3 := orm.TextOf(b, &m.Name) field4 := orm.NumberOf(b, &m.Version) field5 := orm.JSONOf(b, &m.Data) field6 := orm.TimeOf(b, &m.CreatedAt) field7 := orm.NullableTimeOf(b, &m.ReadAt) return InboxTable{ Table: table, ID: field0, Scope: field1, SubjectKey: field2, Name: field3, Version: field4, Data: field5, CreatedAt: field6, ReadAt: field7, } }, orm.ModelFingerprint("e79b54db423bb0ec727f43a9a1031f51c54aafca7d77ba5d1390771ebe0bb5f9"))
Inboxes is the foundry_notification_inbox table.
Functions ¶
This section is empty.
Types ¶
type Delivery ¶
type Delivery struct {
// Table provides model queries and writes. Example: orm.First(ctx, tx, Deliveries.Query()).
//
// KeyColumn binds Delivery.Key.
// Example: orm.Set(Deliveries.KeyColumn, key).
Key string `foundry:"member=KeyColumn"`
// NotificationID binds Delivery.NotificationID.
// Example: orm.Set(Deliveries.NotificationID, notificationID).
NotificationID model.ID[Envelope] `foundry:"role=column"`
// Channel binds Delivery.Channel.
// Example: orm.Set(Deliveries.Channel, channel).
Channel string
// Kind binds Delivery.Kind.
// Example: orm.Set(Deliveries.Kind, kind).
Kind string
// State binds Delivery.State.
// Example: orm.Set(Deliveries.State, state).
State string
// Payload binds Delivery.Payload.
// Example: encoded, err := value.NewJSON(payload); if err == nil { _ = orm.Set(Deliveries.Payload, encoded) }.
Payload value.JSON[json.RawMessage]
// Claim binds Delivery.Claim.
// Example: orm.Set(Deliveries.Claim, claim).
Claim model.ID[Delivery] `foundry:"role=column"`
// Attempts binds Delivery.Attempts.
// Example: orm.Set(Deliveries.Attempts, attempts).
Attempts uint32
// UpdatedAt is caller-managed; the ORM does not refresh it.
// Example: orm.Set(Deliveries.UpdatedAt, updatedAt).
UpdatedAt temporal.DateTime `foundry:"role=time"`
}
Delivery persists a channel independently. Claim remains stable from Running until completion; an abandoned Running row is never automatically resent.
type DeliveryTable ¶
type DeliveryTable struct {
//
// Table provides model queries and writes. Example: orm.First(ctx, tx, Deliveries.Query()).
//
// KeyColumn binds Delivery.Key.
// Example: orm.Set(Deliveries.KeyColumn, key).
//
// See [Delivery.Key].
orm.Table[Delivery, string]
//
// Table provides model queries and writes. Example: orm.First(ctx, tx, Deliveries.Query()).
//
// KeyColumn binds Delivery.Key.
// Example: orm.Set(Deliveries.KeyColumn, key).
//
// See [Delivery.Key].
KeyColumn orm.TextLookupKey[Delivery, string]
//
// NotificationID binds Delivery.NotificationID.
// Example: orm.Set(Deliveries.NotificationID, notificationID).
//
// See [Delivery.NotificationID].
NotificationID orm.Column[Delivery, model.ID[Envelope]]
//
// Channel binds Delivery.Channel.
// Example: orm.Set(Deliveries.Channel, channel).
//
// See [Delivery.Channel].
Channel orm.Text[Delivery, string]
//
// Kind binds Delivery.Kind.
// Example: orm.Set(Deliveries.Kind, kind).
//
// See [Delivery.Kind].
Kind orm.Text[Delivery, string]
//
// State binds Delivery.State.
// Example: orm.Set(Deliveries.State, state).
//
// See [Delivery.State].
State orm.Text[Delivery, string]
//
// Payload binds Delivery.Payload.
// Example: encoded, err := value.NewJSON(payload); if err == nil { _ = orm.Set(Deliveries.Payload, encoded) }.
//
// See [Delivery.Payload].
Payload orm.JSON[Delivery, json.RawMessage]
//
// Claim binds Delivery.Claim.
// Example: orm.Set(Deliveries.Claim, claim).
//
// See [Delivery.Claim].
Claim orm.Column[Delivery, model.ID[Delivery]]
//
// Attempts binds Delivery.Attempts.
// Example: orm.Set(Deliveries.Attempts, attempts).
//
// See [Delivery.Attempts].
Attempts orm.Number[Delivery, uint32]
//
// UpdatedAt is caller-managed; the ORM does not refresh it.
// Example: orm.Set(Deliveries.UpdatedAt, updatedAt).
//
// See [Delivery.UpdatedAt].
UpdatedAt orm.Time[Delivery, temporal.DateTime]
}
DeliveryTable binds the declared fields of Delivery.
type Envelope ¶
type Envelope struct {
// Table provides model queries and writes. Example: orm.First(ctx, tx, Envelopes.Query()).
//
// ID binds Envelope.ID.
// Example: orm.Set(Envelopes.ID, id).
ID model.ID[Envelope] `foundry:"member=ID"`
// Recipient binds Envelope.Recipient.
// Example: orm.Set(Envelopes.Recipient, recipient).
Recipient string
// Scope binds Envelope.Scope.
// Example: orm.Set(Envelopes.Scope, scope).
Scope string
// SubjectKey binds Envelope.SubjectKey.
// Example: orm.Set(Envelopes.SubjectKey, subjectKey).
SubjectKey string
// Identity binds Envelope.Identity.
// Example: encoded, err := value.NewJSON(identity); if err == nil { _ = orm.Set(Envelopes.Identity, encoded) }.
Identity value.JSON[model.Identity]
// Origin binds Envelope.Origin.
// Example: encoded, err := value.NewJSON(origin); if err == nil { _ = orm.Set(Envelopes.Origin, encoded) }.
Origin value.JSON[attribution.Origin]
// Name binds Envelope.Name.
// Example: orm.Set(Envelopes.Name, name).
Name string
// Version binds Envelope.Version.
// Example: orm.Set(Envelopes.Version, version).
Version uint32
// Payload binds Envelope.Payload.
// Example: encoded, err := value.NewJSON(payload); if err == nil { _ = orm.Set(Envelopes.Payload, encoded) }.
Payload value.JSON[json.RawMessage]
// Fingerprint binds Envelope.Fingerprint.
// Example: orm.Set(Envelopes.Fingerprint, fingerprint).
Fingerprint string
// CreatedAt preserves an explicit creation time; callers supply this timestamp.
// Example: orm.Set(Envelopes.CreatedAt, createdAt).
CreatedAt temporal.DateTime `foundry:"role=time"`
}
Envelope is a captured request, not a public inbox DTO.
type EnvelopeTable ¶
type EnvelopeTable struct {
//
// Table provides model queries and writes. Example: orm.First(ctx, tx, Envelopes.Query()).
//
// ID binds Envelope.ID.
// Example: orm.Set(Envelopes.ID, id).
//
// See [Envelope.ID].
orm.Table[Envelope, model.ID[Envelope]]
//
// Table provides model queries and writes. Example: orm.First(ctx, tx, Envelopes.Query()).
//
// ID binds Envelope.ID.
// Example: orm.Set(Envelopes.ID, id).
//
// See [Envelope.ID].
ID orm.Key[Envelope, model.ID[Envelope]]
//
// Recipient binds Envelope.Recipient.
// Example: orm.Set(Envelopes.Recipient, recipient).
//
// See [Envelope.Recipient].
Recipient orm.Text[Envelope, string]
//
// Scope binds Envelope.Scope.
// Example: orm.Set(Envelopes.Scope, scope).
//
// See [Envelope.Scope].
Scope orm.Text[Envelope, string]
//
// SubjectKey binds Envelope.SubjectKey.
// Example: orm.Set(Envelopes.SubjectKey, subjectKey).
//
// See [Envelope.SubjectKey].
SubjectKey orm.Text[Envelope, string]
//
// Identity binds Envelope.Identity.
// Example: encoded, err := value.NewJSON(identity); if err == nil { _ = orm.Set(Envelopes.Identity, encoded) }.
//
// See [Envelope.Identity].
Identity orm.JSON[Envelope, model.Identity]
//
// Origin binds Envelope.Origin.
// Example: encoded, err := value.NewJSON(origin); if err == nil { _ = orm.Set(Envelopes.Origin, encoded) }.
//
// See [Envelope.Origin].
Origin orm.JSON[Envelope, attribution.Origin]
//
// Name binds Envelope.Name.
// Example: orm.Set(Envelopes.Name, name).
//
// See [Envelope.Name].
Name orm.Text[Envelope, string]
//
// Version binds Envelope.Version.
// Example: orm.Set(Envelopes.Version, version).
//
// See [Envelope.Version].
Version orm.Number[Envelope, uint32]
//
// Payload binds Envelope.Payload.
// Example: encoded, err := value.NewJSON(payload); if err == nil { _ = orm.Set(Envelopes.Payload, encoded) }.
//
// See [Envelope.Payload].
Payload orm.JSON[Envelope, json.RawMessage]
//
// Fingerprint binds Envelope.Fingerprint.
// Example: orm.Set(Envelopes.Fingerprint, fingerprint).
//
// See [Envelope.Fingerprint].
Fingerprint orm.Text[Envelope, string]
//
// CreatedAt preserves an explicit creation time; callers supply this timestamp.
// Example: orm.Set(Envelopes.CreatedAt, createdAt).
//
// See [Envelope.CreatedAt].
CreatedAt orm.Time[Envelope, temporal.DateTime]
}
EnvelopeTable binds the declared fields of Envelope.
type Inbox ¶
type Inbox struct {
// Table provides model queries and writes. Example: orm.First(ctx, tx, Inboxes.Query()).
//
// ID binds Inbox.ID.
// Example: orm.Set(Inboxes.ID, id).
ID model.ID[Inbox] `foundry:"member=ID"`
// Scope binds Inbox.Scope.
// Example: orm.Set(Inboxes.Scope, scope).
Scope string
// SubjectKey binds Inbox.SubjectKey.
// Example: orm.Set(Inboxes.SubjectKey, subjectKey).
SubjectKey string
// Name binds Inbox.Name.
// Example: orm.Set(Inboxes.Name, name).
Name string
// Version binds Inbox.Version.
// Example: orm.Set(Inboxes.Version, version).
Version uint32
// Data binds Inbox.Data.
// Example: encoded, err := value.NewJSON(data); if err == nil { _ = orm.Set(Inboxes.Data, encoded) }.
Data value.JSON[json.RawMessage]
// CreatedAt preserves an explicit creation time; callers supply this timestamp.
// Example: orm.Set(Inboxes.CreatedAt, createdAt).
CreatedAt temporal.DateTime `foundry:"role=time"`
// ReadAt binds Inbox.ReadAt.
// Example: orm.SetNull(Inboxes.ReadAt).
ReadAt value.Nullable[temporal.DateTime]
}
Inbox becomes visible atomically with database-channel delivery completion.
type InboxTable ¶
type InboxTable struct {
//
// Table provides model queries and writes. Example: orm.First(ctx, tx, Inboxes.Query()).
//
// ID binds Inbox.ID.
// Example: orm.Set(Inboxes.ID, id).
//
// See [Inbox.ID].
orm.Table[Inbox, model.ID[Inbox]]
//
// Table provides model queries and writes. Example: orm.First(ctx, tx, Inboxes.Query()).
//
// ID binds Inbox.ID.
// Example: orm.Set(Inboxes.ID, id).
//
// See [Inbox.ID].
ID orm.Key[Inbox, model.ID[Inbox]]
//
// Scope binds Inbox.Scope.
// Example: orm.Set(Inboxes.Scope, scope).
//
// See [Inbox.Scope].
Scope orm.Text[Inbox, string]
//
// SubjectKey binds Inbox.SubjectKey.
// Example: orm.Set(Inboxes.SubjectKey, subjectKey).
//
// See [Inbox.SubjectKey].
SubjectKey orm.Text[Inbox, string]
//
// Name binds Inbox.Name.
// Example: orm.Set(Inboxes.Name, name).
//
// See [Inbox.Name].
Name orm.Text[Inbox, string]
//
// Version binds Inbox.Version.
// Example: orm.Set(Inboxes.Version, version).
//
// See [Inbox.Version].
Version orm.Number[Inbox, uint32]
//
// Data binds Inbox.Data.
// Example: encoded, err := value.NewJSON(data); if err == nil { _ = orm.Set(Inboxes.Data, encoded) }.
//
// See [Inbox.Data].
Data orm.JSON[Inbox, json.RawMessage]
//
// CreatedAt preserves an explicit creation time; callers supply this timestamp.
// Example: orm.Set(Inboxes.CreatedAt, createdAt).
//
// See [Inbox.CreatedAt].
CreatedAt orm.Time[Inbox, temporal.DateTime]
//
// ReadAt binds Inbox.ReadAt.
// Example: orm.SetNull(Inboxes.ReadAt).
//
// See [Inbox.ReadAt].
ReadAt orm.NullableTime[Inbox, temporal.DateTime]
}
InboxTable binds the declared fields of Inbox.