Documentation
¶
Overview ¶
Package flowdefinition holds shared encoding helpers for the flow_definitions definition JSON column used by v2 dialect statements.
Index ¶
- Variables
- func EnsureListOptions(opts *database.ListOptions[domain.FlowDefinitionField]) *database.ListOptions[domain.FlowDefinitionField]
- func Marshal(def *domain.FlowDefinition) ([]byte, error)
- func ParsePurposeKey(s string) (domain.FlowDefinitionPurpose, error)
- func PurposeStrings(def *domain.FlowDefinition) []string
- func ToDomain(projectID, id, name, schemaVersion string, status domain.FlowDefinitionStatus, ...) (*domain.FlowDefinition, error)
- type ActionJSON
- type AudienceJSON
- type Content
- type GateJSON
- type SSOProviderJSON
- type StepJSON
- type TransitionJSON
Constants ¶
This section is empty.
Variables ¶
var Schema = database.NewSchema(map[domain.FlowDefinitionField]database.FieldBinding[domain.FlowDefinition]{ domain.FlowDefinitionFieldProjectID: { SQLName: "project_id", Accessor: func(d *domain.FlowDefinition) any { return d.ProjectID }, Coerce: database.CoerceString, }, domain.FlowDefinitionFieldID: { SQLName: "id", Accessor: func(d *domain.FlowDefinition) any { return d.ID }, Coerce: database.CoerceString, }, domain.FlowDefinitionFieldName: { SQLName: "name", Accessor: func(d *domain.FlowDefinition) any { return d.Name }, Coerce: database.CoerceString, }, domain.FlowDefinitionFieldSchemaVersion: { SQLName: "schema_version", Accessor: func(d *domain.FlowDefinition) any { return d.SchemaVersion }, Coerce: database.CoerceString, }, domain.FlowDefinitionFieldStatus: { SQLName: "status", Accessor: func(d *domain.FlowDefinition) any { return d.Status.String() }, Coerce: database.CoerceString, ParamCast: "::zitadel_nextgen.flow_definition_states", }, domain.FlowDefinitionFieldCreatedAt: { SQLName: "created_at", Accessor: func(d *domain.FlowDefinition) any { return d.CreatedAt }, Coerce: database.CoerceTime, }, domain.FlowDefinitionFieldUpdatedAt: { SQLName: "updated_at", Accessor: func(d *domain.FlowDefinition) any { return d.UpdatedAt }, Coerce: database.CoerceTime, }, domain.FlowDefinitionFieldPurposes: { SQLName: "purposes", Accessor: func(d *domain.FlowDefinition) any { return d.Purposes }, Coerce: database.CoerceEnumKeyMapAsAny[domain.FlowDefinitionPurpose, string](ParsePurposeKey), ParamCast: "::zitadel_nextgen.flow_definition_purposes", }, })
Schema binds flow definition list/filter/order fields for both dialects. Nested payload (user schema, audience, steps) lives in the definition JSON column and is handled by Marshal/ToDomain — not as list Schema columns.
Functions ¶
func EnsureListOptions ¶
func EnsureListOptions(opts *database.ListOptions[domain.FlowDefinitionField]) *database.ListOptions[domain.FlowDefinitionField]
EnsureListOptions returns opts with the default CreatedAt+ID DESC order when OrderBy is unset. A nil opts becomes an empty ListOptions.
func Marshal ¶
func Marshal(def *domain.FlowDefinition) ([]byte, error)
Marshal converts the domain aggregate's nested fields into JSON for the definition column.
func ParsePurposeKey ¶
func ParsePurposeKey(s string) (domain.FlowDefinitionPurpose, error)
ParsePurposeKey parses a purposes map key from a cursor token.
func PurposeStrings ¶
func PurposeStrings(def *domain.FlowDefinition) []string
PurposeStrings returns the denormalized purposes array column values.
Types ¶
type ActionJSON ¶
type AudienceJSON ¶
type Content ¶
type Content struct {
UserSchema string `json:"user_schema"`
Purposes map[string]string `json:"purposes"`
Audience AudienceJSON `json:"audience"`
Steps []StepJSON `json:"steps"`
}
Content is the structure stored inside the definition JSON/JSONB column.
type SSOProviderJSON ¶
type StepJSON ¶
type StepJSON struct {
Name string `json:"name"`
Fields []string `json:"fields,omitempty"`
Actions []ActionJSON `json:"actions,omitempty"`
Gates map[string]GateJSON `json:"gates,omitempty"`
SSOProviders []SSOProviderJSON `json:"sso_providers,omitempty"`
OnSuccess *string `json:"on_success,omitempty"`
Complete *string `json:"complete,omitempty"`
Transitions map[string]TransitionJSON `json:"transitions,omitempty"`
}