Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseModel ¶
type BaseModel struct { ID uuid.UUID `db:"id" json:"id" yaml:"id"` Created time.Time `db:"created" json:"created" yaml:"created"` Updated time.Time `db:"updated" json:"updated" yaml:"updated"` Deleted time.Time `db:"deleted" json:"deleted" yaml:"deleted"` }
BaseModel underlies (almost) all of our models
func NewBaseWithID ¶
NewBaseWithID initializes a new BaseModel with a specific ID
func (BaseModel) GetCreated ¶ added in v0.3.0
GetCreated is part of the BaseModelable interface
func (BaseModel) GetDeleted ¶ added in v0.3.0
GetDeleted is part of the BaseModelable interface
func (BaseModel) GetUpdated ¶ added in v0.3.0
GetUpdated is part of the BaseModelable interface
type BaseModelable ¶ added in v0.3.0
type BaseModelable interface { GetCreated() time.Time GetDeleted() time.Time GetID() uuid.UUID GetUpdated() time.Time }
BaseModelable is an interface that all BaseModel instances and ancestors support Golang generics do not currently support accessing a struct field for a generic type within a method, so this interface was created to enable us to have generic methods that take any model object that is derived from the BaseModel struct, and be able to access any of the fields in BaseModel from within the generic method.
type UserBaseModel ¶
type UserBaseModel struct { BaseModel UserID uuid.UUID `db:"user_id" json:"user_id" yaml:"user_id"` }
UserBaseModel is a user-related underlying model for many of our models eg. in IDP
func NewUserBase ¶
func NewUserBase(userID uuid.UUID) UserBaseModel
NewUserBase initializes a new user base model
func (UserBaseModel) Validate ¶
func (u UserBaseModel) Validate() error
Validate implements Validateable
type VersionBaseModel ¶ added in v0.3.0
type VersionBaseModel struct { BaseModel // we use _version here to indicate that it's system-managed (as distinct from eg. versioned Access Policies) Version int `db:"_version" json:"version"` }
VersionBaseModel supports safe concurrent updates with version checks (only save if you have extant version)
func NewVersionBase ¶ added in v0.3.0
func NewVersionBase() VersionBaseModel
NewVersionBase initializes a new VersionBaseModel
func NewVersionBaseWithID ¶ added in v0.3.0
func NewVersionBaseWithID(id uuid.UUID) VersionBaseModel
NewVersionBaseWithID initializes a new VersionBaseModel with a specific ID