sessionfields

package
v0.0.0-...-a9ad9ac Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sessionfields validates the common configuration used by session issuance, public updates and the three relational schema generators.

Index

Constants

View Source
const MillisecondUTC = "2006-01-02T15:04:05.000Z"

Variables

This section is empty.

Functions

func AccountNameOK

func AccountNameOK(name string) bool

func NameOK

func NameOK(name string) bool

func Names

func Names(fields map[string]Field) []string

func Normalize

func Normalize(fields map[string]Field) (map[string]Field, error)

Normalize resolves physical names and freezes static scalar defaults.

func NormalizeAccount

func NormalizeAccount(fields map[string]Field) (map[string]Field, error)

func NormalizeRole

func NormalizeRole(fields map[string]Field) (map[string]Field, error)

func NormalizeSSOProvider

func NormalizeSSOProvider(fields map[string]Field) (map[string]Field, error)

func NormalizeUser

func NormalizeUser(fields map[string]Field) (map[string]Field, error)

func RoleNameOK

func RoleNameOK(name string) bool

RoleNameOK reserves the stored columns and the selectors used on role updates.

func SSOProviderNameOK

func SSOProviderNameOK(name string) bool

SSOProviderNameOK reserves the provider columns and the keys of provider requests and responses.

func UserNameOK

func UserNameOK(name string) bool

UserNameOK reserves core profile, authentication input and installed plugin attributes.

Types

type ElementError

type ElementError struct {
	Index    int
	Expected string
	Value    any
}

ElementError points to an invalid element in a typed array.

type ElementErrors

type ElementErrors []ElementError

func (ElementErrors) Error

func (e ElementErrors) Error() string

type Field

type Field struct {
	Type   Type
	Column string
	// Default accepts a scalar or a non-nil func() T returning one scalar.
	Default                      any
	Required, ServerOnly, Hidden bool
}

func (Field) CreationDefault

func (f Field) CreationDefault() (value any, err error)

CreationDefault obtains and validates a new value for a normalized field.

func (Field) Definition

func (f Field) Definition(dialect string) string

Definition returns one fresh-schema column after Normalize has validated its name.

func (Field) JSONColumn

func (f Field) JSONColumn() bool

JSONColumn reports whether the logical value uses JSON storage.

func (Field) PublicValue

func (f Field) PublicValue(raw any) (any, error)

PublicValue preserves milliseconds in the JSON representation of a date.

func (Field) StaticDefault

func (f Field) StaticDefault() any

StaticDefault returns the configured backfill value. A callback can only provide values for new records and never runs during reads or migrations.

func (Field) Value

func (f Field) Value(raw any) (any, error)

Value normalizes scalar numbers to the portable signed INTEGER range.

type Type

type Type string
const (
	String  Type = "string"
	Number  Type = "number"
	Boolean Type = "boolean"
	Date    Type = "date"
)
const (
	JSON        Type = "json"
	StringArray Type = "string[]"
	NumberArray Type = "number[]"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL