Documentation
¶
Overview ¶
Package model provides Soro's persistence model primitives.
Index ¶
- type Base
- type Entity
- type Metadata
- func (m Metadata) Delete(key string)
- func (m Metadata) Get(key string) (any, bool)
- func (m Metadata) GetBool(key string) (bool, error)
- func (m Metadata) GetInt(key string) (int, error)
- func (m Metadata) GetString(key string) (string, error)
- func (m Metadata) Has(key string) bool
- func (m *Metadata) Scan(src any) error
- func (m *Metadata) Set(key string, value any)
- func (m Metadata) Value() (driver.Value, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Base ¶
type Base struct {
ID uuid.UUID `bun:"id,pk,type:uuid" json:"id"`
Name string `bun:"name,type:varchar(255)" json:"name"`
Description string `bun:"description,type:text" json:"description"`
Metadata Metadata `bun:"metadata,type:jsonb,notnull,default:'{}'" json:"metadata"`
CreatedAt time.Time `bun:"created_at,type:timestamptz,notnull" json:"created_at"`
UpdatedAt time.Time `bun:"updated_at,type:timestamptz,notnull" json:"updated_at"`
DeletedAt *time.Time `bun:"deleted_at,type:timestamptz,nullzero" json:"deleted_at,omitempty"`
CreatedBy *uuid.UUID `bun:"created_by,type:uuid,nullzero" json:"created_by,omitempty"`
UpdatedBy *uuid.UUID `bun:"updated_by,type:uuid,nullzero" json:"updated_by,omitempty"`
DeletedBy *uuid.UUID `bun:"deleted_by,type:uuid,nullzero" json:"deleted_by,omitempty"`
}
Base is embedded by normal Soro models. IDs are generated by repositories as UUIDv7 values before lifecycle validation begins.
type Entity ¶
type Entity interface {
SoroBase() *Base
}
Entity is implemented by pointers to structs that embed Base.
Click to show internal directories.
Click to hide internal directories.