orm

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: MIT Imports: 5 Imported by: 1

README

orm

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Count

func Count(executor Executor, statement string, c *int, arg model.Arg) error

func Delete

func Delete(executor Executor, statement string, m model.Identifier) (err error)

func Get

func Get(executor Executor, statement string, m model.Identifier) error

func NamedInsert

func NamedInsert(executor Executor, statement string, m model.Identifier) error

func NamedSave

func NamedSave(executor Executor, statement string, m model.Identifier) error

func NamedUpdate

func NamedUpdate(executor Executor, statement string, m model.Identifier) error

func Select

func Select(executor Executor, statement string, list any, arg model.Arg) error

Types

type Counter

type Counter interface {
	Count(...model.Arg) (int, error)
	CountTx(*sqlx.Tx, ...model.Arg) (int, error)
}

type Deleter

type Deleter[M model.Identifier] interface {
	Delete(M) error
	DeleteTx(*sqlx.Tx, M) error
}

type Executor

type Executor interface {
	NamedExec(string, any) (sql.Result, error)
	PrepareNamed(string) (*sqlx.NamedStmt, error)
}

type Finder

type Finder[M model.Identifier] interface {
	Find(...model.Arg) ([]M, error)
}

type Geter

type Geter[M model.Identifier] interface {
	Get(M) error
	GetTx(*sqlx.Tx, M) error
}

type Inserter

type Inserter[M model.Identifier] interface {
	Insert(M) error
	InsertTx(*sqlx.Tx, M) error
}

type ORM added in v0.0.2

type ORM[M model.Identifier] interface {
	Inserter[M]
	Saver[M]
	Updater[M]
	Geter[M]
	Deleter[M]
	Finder[M]
	Counter
	Pager[M]
}

type ORMBase added in v0.0.2

type ORMBase[M model.Identifier, S sql.SQL] struct {
	Executor
	Stmt S
}

func (*ORMBase[M, S]) Count added in v0.0.2

func (o *ORMBase[M, S]) Count(args ...model.Arg) (c int, err error)

func (*ORMBase[M, S]) CountTx added in v0.0.2

func (o *ORMBase[M, S]) CountTx(tx *sqlx.Tx, args ...model.Arg) (c int, err error)

func (*ORMBase[M, S]) Delete added in v0.0.2

func (o *ORMBase[M, S]) Delete(m M) error

func (*ORMBase[M, S]) DeleteTx added in v0.0.2

func (o *ORMBase[M, S]) DeleteTx(tx *sqlx.Tx, m M) error

func (*ORMBase[M, S]) Find added in v0.0.2

func (o *ORMBase[M, S]) Find(args ...model.Arg) (list []M, err error)

func (*ORMBase[M, S]) Get added in v0.0.2

func (o *ORMBase[M, S]) Get(m M) error

func (*ORMBase[M, S]) GetTx added in v0.0.2

func (o *ORMBase[M, S]) GetTx(tx *sqlx.Tx, m M) error

func (*ORMBase[M, S]) Insert added in v0.0.2

func (o *ORMBase[M, S]) Insert(m M) error

func (*ORMBase[M, S]) InsertTx added in v0.0.2

func (o *ORMBase[M, S]) InsertTx(tx *sqlx.Tx, m M) error

func (*ORMBase[M, S]) PaginationTx added in v0.0.2

func (o *ORMBase[M, S]) PaginationTx(tx *sqlx.Tx, pager model.Pager) (list []M, err error)

func (*ORMBase[M, S]) Save added in v0.0.2

func (o *ORMBase[M, S]) Save(m M) error

func (*ORMBase[M, S]) SaveTx added in v0.0.2

func (o *ORMBase[M, S]) SaveTx(tx *sqlx.Tx, m M) error

func (*ORMBase[M, S]) Update added in v0.0.2

func (o *ORMBase[M, S]) Update(m M) error

func (*ORMBase[M, S]) UpdateTx added in v0.0.2

func (o *ORMBase[M, S]) UpdateTx(tx *sqlx.Tx, m M) error

type Pager

type Pager[M model.Identifier] interface {
	PaginationTx(*sqlx.Tx, model.Pager) ([]M, error)
}

type Saver

type Saver[M model.Identifier] interface {
	Save(M) error
	SaveTx(*sqlx.Tx, M) error
}

type Updater

type Updater[M model.Identifier] interface {
	Update(M) error
	UpdateTx(*sqlx.Tx, M) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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