orm

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoRows = errs.ErrNoRows
)

Functions

This section is empty.

Types

type Column

type Column struct {
	Name string
}

func C

func C(columnName string) Column

func (Column) Eq

func (c Column) Eq(val any) Predicate

func (Column) LT added in v0.1.24

func (c Column) LT(val any) Predicate

type DB

type DB struct {
	// contains filtered or unexported fields
}

func MustNewDB

func MustNewDB(driveName string, dataSourceName string, opts ...DBOption) *DB

func Open added in v0.1.24

func Open(driveName string, dataSourceName string, opts ...DBOption) (*DB, error)

func OpenDB added in v0.1.24

func OpenDB(sqlDB *sql.DB, opts ...DBOption) (*DB, error)

type DBOption

type DBOption func(db *DB)

func DBWithCreator added in v0.1.24

func DBWithCreator(creator valuer.Creator) DBOption

func DBWithRegister

func DBWithRegister(r *schema.Register) DBOption

type Deleter

type Deleter[T any] struct {
	// contains filtered or unexported fields
}

func NewDeleter

func NewDeleter[T any](db *DB) *Deleter[T]

func (*Deleter[T]) Build

func (d *Deleter[T]) Build() (*Query, error)

func (*Deleter[T]) Exec

func (d *Deleter[T]) Exec(ctx context.Context) (sql.Result, error)

func (*Deleter[T]) From

func (d *Deleter[T]) From(tableName string) *Deleter[T]

func (*Deleter[T]) Where

func (d *Deleter[T]) Where(e Predicate) *Deleter[T]

type Executor

type Executor interface {
	Exec(ctx context.Context) (sql.Result, error)
}

type Expression

type Expression interface {
	// contains filtered or unexported methods
}

type Predicate

type Predicate struct {
	// contains filtered or unexported fields
}

func Not

func Not(right Predicate) Predicate

func (Predicate) And

func (left Predicate) And(right Predicate) Predicate

func (Predicate) Or

func (left Predicate) Or(right Predicate) Predicate

type Querier

type Querier[T any] interface {
	Get(ctx context.Context) (*T, error)
	GetMulti(ctx context.Context) ([]*T, error)
}

Querier querier 用于select语句

type Query

type Query struct {
	SQL  string
	Args []any
}

type QueryBuilder

type QueryBuilder interface {
	Build() (*Query, error)
}

type Selector

type Selector[T any] struct {
	// contains filtered or unexported fields
}

func NewSelector

func NewSelector[T any](db *DB) *Selector[T]

func (*Selector[T]) Build

func (s *Selector[T]) Build() (*Query, error)

func (*Selector[T]) From

func (s *Selector[T]) From(tableName string) *Selector[T]

func (*Selector[T]) Get

func (s *Selector[T]) Get(ctx context.Context) (*T, error)

func (*Selector[T]) GetMulti

func (s *Selector[T]) GetMulti(ctx context.Context) ([]*T, error)

func (*Selector[T]) Where

func (s *Selector[T]) Where(e Predicate) *Selector[T]

Directories

Path Synopsis
internal
元数据注册中心
元数据注册中心
until

Jump to

Keyboard shortcuts

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