Documentation
¶
Index ¶
- type Entity
- type Mapper
- type Model
- type Repo
- func (r *Repo[S, M]) NewEntity() S
- func (r *Repo[S, M]) NewFromModel(ctx context.Context, m *M) (S, error)
- func (r *Repo[D, M]) SelectSingleWithBuilder(ctx context.Context, b sq.SelectBuilder) (*M, error)
- func (r *Repo[D, M]) SelectWithBuilder(ctx context.Context, b sq.SelectBuilder) ([]*M, error)
- func (r *Repo[S, M]) WithMapper(m Mapper[S, M]) *Repo[S, M]
- func (r *Repo[S, M]) WithNew(fn func() S) *Repo[S, M]
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mapper ¶
type Mapper[S Model[M], M any] interface { ToModel(ctx context.Context, src S) (*M, error) FromModel(ctx context.Context, src S, model *M) (S, error) ToList(ctx context.Context, list []S) ([]*M, error) }
Mapper database model mapper
type Model ¶
type Model[M any] interface { ToModel(ctx context.Context) (*M, error) FromModel(ctx context.Context, m *M) error }
Model database model
type Repo ¶
Repo entity repository
func (*Repo[S, M]) NewFromModel ¶
func (*Repo[D, M]) SelectSingleWithBuilder ¶
SelectSingleWithBuilder executes squirrel select builder and returns mapped result
func (*Repo[D, M]) SelectWithBuilder ¶
SelectWithBuilder executes squirrel select builder and returns mapped result
func (*Repo[S, M]) WithMapper ¶
WithMapper sets repository model mapper
Click to show internal directories.
Click to hide internal directories.