userstore

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column added in v0.3.0

type Column struct {
	// Columns may be renamed, but their ID cannot be changed.
	ID   uuid.UUID  `json:"id" validate:"notnil"`
	Name string     `json:"name" validate:"notempty"`
	Type ColumnType `json:"type"`
}

Column represents a single field/column/value to be collected/stored/managed in the user data store of a tenant.

type ColumnAccessor added in v0.3.0

type ColumnAccessor struct {
	ID uuid.UUID `json:"id" validate:"notnil"`

	// Friendly ID, must be unique?
	Name string `json:"name" validate:"notempty"`

	// the columns that are accessed here
	ColumnIDs []uuid.UUID `json:"column_ids" validate:"notnil"`

	// makes decisions about who can access this particular view of this field
	AccessPolicyID uuid.UUID `json:"access_policy_id" validate:"notnil"`

	// transforms the value of this field before it is returned to the client
	TransformationPolicyID uuid.UUID `json:"transformation_policy_id" validate:"notnil"`
}

ColumnAccessor represents a customer-defined view / permissions policy on a column

type ColumnAccessors added in v0.3.0

type ColumnAccessors []ColumnAccessor

ColumnAccessors is simply a slice of ColumnAccessor, and this type exists soley so that we can hang Scan() and Value() on it to make the db layer work.

type ColumnType added in v0.3.0

type ColumnType int

ColumnType is an enum for supported column types

const (
	ColumnTypeInvalid ColumnType = 0

	ColumnTypeString ColumnType = 100

	ColumnTypeTimestamp ColumnType = 200
)

ColumnType constants (leaving gaps intentionally to allow future related types to be grouped) NOTE: keep in sync with mapColumnType defined in TenantUserStoreConfig.tsx

func (ColumnType) MarshalText added in v0.3.0

func (t ColumnType) MarshalText() ([]byte, error)

MarshalText implements encoding.TextMarshaler (for JSON)

func (ColumnType) String added in v0.3.0

func (t ColumnType) String() string

just here for easier debugging

func (*ColumnType) UnmarshalText added in v0.3.0

func (t *ColumnType) UnmarshalText(b []byte) error

UnmarshalText implements encoding.TextMarshaler (for JSON)

func (ColumnType) Validate added in v0.3.0

func (ft ColumnType) Validate() error

Validate implements Validateable

type Record

type Record map[uuid.UUID]interface{}

Record is a single "row" of data containing 0 or more Columns that adhere to a Schema. The key is the Column UUID, since names can change but IDs are stable.

func (Record) FixupAndValidate

func (r Record) FixupAndValidate(s *Schema) error

FixupAndValidate validates a record against a schema, and fixes up types in the record to match the schema when possible (e.g. since JSON and other serde formats don't preserve Go types, this attempts to parse rich types from strings as needed). This method should be called whenever a Record is deserialized.

func (Record) Validate

func (r Record) Validate() error

Validate implements Validateable and ensures that a Record has columns which consist only of valid ColumnTypes. TODO: need a Validation method that validates against a particular schema.

type Schema

type Schema struct {
	Columns []Column `json:"columns"`
}

Schema defines the format of the User Data Store/Vault for a given tenant.

Jump to

Keyboard shortcuts

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