mobone

package module
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2024 License: MIT Imports: 7 Imported by: 0

README

Mobone

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateModelI

type CreateModelI interface {
	CreateColumnMap() map[string]any
	ReturningColumnMap() map[string]any
}

type GetModelI

type GetModelI interface {
	ListColumnMap() map[string]any
	PKColumnMap() map[string]any
}

type ListModelI

type ListModelI interface {
	ListColumnMap() map[string]any
	DefaultSortColumns() []string
}

type ListParams

type ListParams struct {
	Conditions           map[string]any
	ConditionExpressions map[string][]any
	Distinct             bool
	Columns              []string
	Page                 int64
	PageSize             int64
	WithTotalCount       bool
	OnlyCount            bool
	Sort                 []string
}

type ModelStore

type ModelStore[ListModel ListModelI, GetModel GetModelI, CreateModel CreateModelI, UpdateModel UpdateModelI] struct {
	Con                  *pgxpool.Pool
	QB                   squirrel.StatementBuilderType
	TableName            string
	ListModelConstructor func() ListModel
}

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Create

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Create(ctx context.Context, m CreateModel) error

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) CreateIfNotExist added in v1.4.0

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) CreateIfNotExist(ctx context.Context, m UpdateCreateModelI) error

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Delete

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Delete(ctx context.Context, m UpdateModel) error

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Get

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Get(ctx context.Context, m GetModelI) (bool, error)

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) List

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) List(ctx context.Context, params ListParams) ([]ListModel, int64, error)

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Update

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) Update(ctx context.Context, m UpdateModel) error

func (*ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) UpdateOrCreate added in v1.4.0

func (s *ModelStore[ListModel, GetModel, CreateModel, UpdateModel]) UpdateOrCreate(ctx context.Context, m UpdateCreateModelI) error

type UpdateCreateModelI added in v1.4.0

type UpdateCreateModelI interface {
	UpdateModelI
	CreateModelI
}

type UpdateModelI

type UpdateModelI interface {
	UpdateColumnMap() map[string]any
	PKColumnMap() map[string]any
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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