Documentation ¶
Index ¶
- func MapIDField[E Entity[I], I ID, P ePtr[E, I]](m *FieldMap[E], col *bsq.Column) error
- type Base
- type DBRepo
- func (r *DBRepo[E, I, P]) Create(q sqlize.Querier, entity P) (*E, error)
- func (r *DBRepo[E, I, P]) CreateContext(ctx context.Context, q sqlize.Querier, entity P) (*E, error)
- func (r *DBRepo[E, I, _]) Delete(q sqlize.Querier, id I) error
- func (r *DBRepo[E, I, _]) DeleteContext(ctx context.Context, q sqlize.Querier, id I) error
- func (r *DBRepo[E, I, P]) Prepare(db *sql.DB) error
- func (r *DBRepo[E, I, P]) PrepareContext(ctx context.Context, db *sql.DB) error
- func (r *DBRepo[E, I, P]) Read(q sqlize.Querier, id I, reuse P) (*E, error)
- func (r *DBRepo[E, I, P]) ReadContext(ctx context.Context, q sqlize.Querier, id I, reuse P) (*E, error)
- func (r *DBRepo[E, _, _]) Update(q sqlize.Querier, entity *E) error
- func (r *DBRepo[E, _, _]) UpdateContext(ctx context.Context, q sqlize.Querier, entity *E) error
- type Entity
- type FieldMap
- func (m *FieldMap[E]) BindOut(e *E, hint any, reuse []any, cols ...*bsq.Column) []any
- func (m *FieldMap[E]) BindParams(e *E, hint any, reuse []any, cols ...*bsq.Column) []any
- func (m *FieldMap[E]) Clone() *FieldMap[E]
- func (m *FieldMap[E]) FromSQL(i int) MapFunc[E]
- func (m *FieldMap[E]) MapBoth(col *bsq.Column, tofrom MapFunc[E]) error
- func (m *FieldMap[E]) MapFrom(col *bsq.Column, from MapFunc[E]) error
- func (m *FieldMap[E]) MapMethods(mode MapMode, cols ...*bsq.Column) error
- func (m *FieldMap[E]) MapTo(col *bsq.Column, to MapFunc[E]) error
- func (m *FieldMap[E]) MapToAndFrom(col *bsq.Column, toSQL, fromSQL MapFunc[E]) error
- func (m *FieldMap[E]) ToSQL(i int) MapFunc[E]
- type ID
- type ID16
- type ID32
- type ID64
- type MapCache
- func (mc *MapCache[E, I, P]) Clear()
- func (mc *MapCache[E, I, P]) Create(q sqlize.Querier, entity P) (*E, error)
- func (mc *MapCache[E, I, P]) CreateContext(ctx context.Context, q sqlize.Querier, entity P) (*E, error)
- func (mc *MapCache[E, I, P]) Delete(q sqlize.Querier, id I) error
- func (mc *MapCache[E, I, P]) DeleteContext(ctx context.Context, q sqlize.Querier, id I) error
- func (mc *MapCache[E, I, P]) Read(q sqlize.Querier, id I, reuse P) (*E, error)
- func (mc *MapCache[E, I, P]) ReadContext(ctx context.Context, q sqlize.Querier, id I, reuse P) (*E, error)
- func (mc *MapCache[E, I, P]) Update(q sqlize.Querier, entity P) error
- func (mc *MapCache[E, I, P]) UpdateContext(ctx context.Context, q sqlize.Querier, entity P) error
- type MapFunc
- type MapMode
- type Reader
- type Ref
- func (ref *Ref[E, ID]) Clear()
- func (ref *Ref[E, ID]) Get(db sqlize.Querier) (*E, error)
- func (ref *Ref[E, ID]) GetContext(ctx context.Context, db sqlize.Querier) (entity *E, err error)
- func (ref Ref[E, ID]) ID() ID
- func (ref Ref[E, ID]) Nil() bool
- func (ref Ref[E, ID]) Resolved() (is bool, entity *E)
- func (ref *Ref[E, I]) Scanner(r Reader[E, I]) refScanner[E, I]
- func (ref *Ref[E, ID]) Set(entity *E)
- func (ref *Ref[E, ID]) SetID(r Reader[E, ID], id ID) error
- func (ref *Ref[E, ID]) SetReader(r Reader[E, ID])
- func (ref Ref[E, ID]) Value() (driver.Value, error)
- func (ref Ref[E, ID]) WithReader(r Reader[E, ID]) (res Ref[E, ID])
- type Repo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DBRepo ¶
func (*DBRepo[E, I, P]) CreateContext ¶ added in v0.9.0
func (*DBRepo[E, I, _]) DeleteContext ¶ added in v0.9.0
func (*DBRepo[E, I, P]) PrepareContext ¶ added in v0.9.0
func (*DBRepo[E, I, P]) ReadContext ¶
type FieldMap ¶
type FieldMap[E any] struct { // contains filtered or unexported fields }
func (*FieldMap[E]) BindParams ¶
func (*FieldMap[E]) MapMethods ¶
func (*FieldMap[E]) MapToAndFrom ¶
type MapCache ¶ added in v0.9.0
type MapCache[E Entity[I], I ID, P ePtr[E, I]] struct { Repo Repo[E, I] // contains filtered or unexported fields }
MapCache is a simple write-through cache for repos that does not implement any eviction strategy. It only allows to explicitly [Clear] the cache. MapCache implements the Repo interface.
func NewMapCache ¶ added in v0.9.0
func (*MapCache[E, I, P]) CreateContext ¶ added in v0.9.0
func (*MapCache[E, I, P]) DeleteContext ¶ added in v0.9.0
func (*MapCache[E, I, P]) ReadContext ¶ added in v0.9.0
type MapMode ¶
type MapMode uint
const ( MapAllTo MapMode = (1 << iota) MapAllFrom MapAll = MapAllTo | MapAllFrom )
type Repo ¶
type Repo[E Entity[I], I ID] interface { Reader[E, I] Read(q sqlize.Querier, id I, reuse *E) (*E, error) Create(q sqlize.Querier, entity *E) (*E, error) CreateContext(ctx context.Context, q sqlize.Querier, entity *E) (*E, error) Update(q sqlize.Querier, entity *E) error UpdateContext(ctx context.Context, q sqlize.Querier, entity *E) error Delete(q sqlize.Querier, id I) error DeleteContext(ctx context.Context, q sqlize.Querier, id I) error }
Click to show internal directories.
Click to hide internal directories.