aorm

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrCombineOperator  = ") OR ("
	AndCombineOperator = ") AND ("
)

Variables

This section is empty.

Functions

func And

func And(u interface{}, fields ...string) (s string)

func AndWithWhere

func AndWithWhere(u interface{}, fields ...string) string

func Comma

func Comma(u interface{}, fields ...string) (s string)

func CommaWithEnd

func CommaWithEnd(u interface{}, fields ...string) string

func CommaWithHead

func CommaWithHead(u interface{}, fields ...string) string

func Fields

func Fields(u interface{}, fields ...string) string

func Like

func Like(u interface{}, fields ...string) (s string)

func Or

func Or(u interface{}, fields ...string) (s string)

func OrWithWhere

func OrWithWhere(u interface{}, fields ...string) string

func OrderBy

func OrderBy(u interface{}, orm ORM) string

func Where

func Where(conds ...string) string

Types

type ASQL

type ASQL struct {
	EqualTo          string
	UnequalTo        string
	Like             string
	In               []string
	GreaterOrEqualTo string
	LessThan         string
	GreaterThan      string
	LessOrEqualTo    string
	StartWith        string
	EndWith          string
}

func MakeASQL

func MakeASQL(v string) ASQL

func (ASQL) Fmt

func (q ASQL) Fmt(k string) string

type CombineOperator

type CombineOperator string

type DB

type DB struct {
	DB *sql.DB
	// contains filtered or unexported fields
}

func AliveDriver

func AliveDriver(db *sql.DB, close bool, err error) *DB

func Driver

func Driver(db *sql.DB, err error) *DB

func (*DB) Begin

func (db *DB) Begin() (*sql.Tx, error)

func (*DB) BeginTx

func (db *DB) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

func (*DB) Close

func (d *DB) Close()

func (*DB) CloseRows

func (d *DB) CloseRows(rows *sql.Rows) *ae.Error

func (*DB) Exec

func (d *DB) Exec(query string, args ...interface{}) (sql.Result, *ae.Error)

func (*DB) ExecContext

func (d *DB) ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, *ae.Error)

func (*DB) Insert

func (d *DB) Insert(ctx context.Context, query string, args ...interface{}) (uint, *ae.Error)

func (*DB) Query

func (d *DB) Query(query string, args ...interface{}) (*sql.Rows, *ae.Error)

func (*DB) QueryContext

func (d *DB) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, *ae.Error)

func (*DB) QueryRow

func (d *DB) QueryRow(query string, args ...interface{}) (*sql.Row, *ae.Error)

func (*DB) QueryRowContext

func (d *DB) QueryRowContext(ctx context.Context, query string, args ...interface{}) (*sql.Row, *ae.Error)

func (*DB) ScanRow

func (d *DB) ScanRow(query string, dest ...interface{}) *ae.Error

func (*DB) ScanRowContext

func (d *DB) ScanRowContext(ctx context.Context, query string, dest ...interface{}) *ae.Error

type Limit

type Limit struct {
	Offset int `name:"offset"`
	Limit  int `name:"limit"`
}

type ORM

type ORM struct {
	CombineOperator CombineOperator
	Limit           *Limit
	OrderBy         string
	OrderByDesc     string
	AndFields       []string
	OrFields        []string
	LikeFields      []string

	Index []string
	And   map[string]ASQL
	Or    map[string]ASQL
}

func (ORM) WithWhere

func (orm ORM) WithWhere(t interface{}) string

Jump to

Keyboard shortcuts

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