orm

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

元数据注册中心

Index

Constants

This section is empty.

Variables

This section is empty.

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

type DB

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

func MustNewDB

func MustNewDB(opts ...DBOption) *DB

func NewDB

func NewDB(opts ...DBOption) (*DB, error)

type DBOption

type DBOption func(db *DB)

func DBWithRegister

func DBWithRegister(r *register) DBOption

type Deleter

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

func NewDeleter

func NewDeleter[T any]() *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 用于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]() *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