sql

package
v2.0.0-...-d0150a3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDatabase

func GetDatabase(ctx context.Context) string

GetDatabase :

func GetField

func GetField(ctx context.Context) reflext.FieldInfo

GetField :

func GetTable

func GetTable(ctx context.Context) string

GetTable :

Types

type Column

type Column struct {
	Name         string
	DataType     string
	Type         string
	Size         int
	Nullable     bool
	DefaultValue *string
	Charset      *string
	Collation    *string
	Extra        string
}

Column :

type DeleteStmt

type DeleteStmt struct {
	Tables     []any
	Conditions primitive.Group
	Sorts      []any
	RowCount   uint
}

DeleteStmt :

func (*DeleteStmt) From

func (stmt *DeleteStmt) From(values ...any) *DeleteStmt

From :

func (*DeleteStmt) Limit

func (stmt *DeleteStmt) Limit(num uint) *DeleteStmt

Limit :

func (*DeleteStmt) OrderBy

func (stmt *DeleteStmt) OrderBy(fields ...any) *DeleteStmt

OrderBy :

func (*DeleteStmt) Where

func (stmt *DeleteStmt) Where(fields ...any) *DeleteStmt

Where :

type Direction

type Direction int

Direction :

const (
	Ascending Direction = iota
	Descending
)

direction :

type Index

type Index struct {
	Name    string
	Cast    string
	As      string
	Type    Type
	Columns []IndexColumn
	Comment string
}

Index :

func (Index) GetName

func (idx Index) GetName() string

GetName :

func (Index) HashName

func (idx Index) HashName() string

HashName :

type IndexColumn

type IndexColumn struct {
	Name      string
	Direction Direction
}

IndexColumn :

func IndexedColumn

func IndexedColumn(name string) IndexColumn

IndexedColumn :

func IndexedColumns

func IndexedColumns(names ...string) []IndexColumn

IndexedColumns :

type SQLCtx

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

func Context

func Context(
	dbName string,
	table string,
) *SQLCtx

Context :

func (*SQLCtx) Deadline

func (*SQLCtx) Deadline() (deadline time.Time, ok bool)

func (*SQLCtx) Done

func (*SQLCtx) Done() <-chan struct{}

func (*SQLCtx) Err

func (*SQLCtx) Err() error

func (*SQLCtx) SetField

func (c *SQLCtx) SetField(v reflext.FieldInfo) *SQLCtx

func (*SQLCtx) String

func (e *SQLCtx) String() string

func (*SQLCtx) Value

func (c *SQLCtx) Value(key any) any

type SelectStmt

type SelectStmt struct {
	DistinctOn bool
	Tables     []any
	Exprs      []any
	Joins      []primitive.Join
	IndexHints string
	Conditions primitive.Group
	Havings    primitive.Group
	Groups     []any
	Sorts      []any
	RowCount   uint
	Skip       uint
	Opts       []any
}

SelectStmt :

func Select

func Select(fields ...any) *SelectStmt

Select :

func (*SelectStmt) CrossJoin

func (stmt *SelectStmt) CrossJoin(subQuery, first, second any) *SelectStmt

CrossJoin :

func (*SelectStmt) Distinct

func (stmt *SelectStmt) Distinct() *SelectStmt

Distinct :

func (*SelectStmt) From

func (stmt *SelectStmt) From(values ...any) *SelectStmt

From :

func (*SelectStmt) GroupBy

func (stmt *SelectStmt) GroupBy(fields ...any) *SelectStmt

GroupBy :

func (*SelectStmt) Having

func (stmt *SelectStmt) Having(fields ...any) *SelectStmt

Having :

func (*SelectStmt) InnerJoin

func (stmt *SelectStmt) InnerJoin(subQuery, first, second any) *SelectStmt

InnerJoin :

func (*SelectStmt) LeftJoin

func (stmt *SelectStmt) LeftJoin(subQuery, first, second any) *SelectStmt

LeftJoin :

func (*SelectStmt) Limit

func (stmt *SelectStmt) Limit(num uint) *SelectStmt

Limit :

func (*SelectStmt) Offset

func (stmt *SelectStmt) Offset(num uint) *SelectStmt

Offset :

func (*SelectStmt) Option

func (stmt *SelectStmt) Option(opts ...any) *SelectStmt

Option :

func (*SelectStmt) OrderBy

func (stmt *SelectStmt) OrderBy(fields ...any) *SelectStmt

OrderBy :

func (*SelectStmt) RightJoin

func (stmt *SelectStmt) RightJoin(subQuery, first, second any) *SelectStmt

RightJoin :

func (*SelectStmt) Select

func (stmt *SelectStmt) Select(fields ...any) *SelectStmt

Select :

func (*SelectStmt) Where

func (stmt *SelectStmt) Where(fields ...any) *SelectStmt

Where :

type Type

type Type int

Type :

const (
	BTree Type = iota + 1
	FullText
	Unique
	Spatial
	Primary
	MultiValued
)

types :

func (Type) String

func (t Type) String() string

type UpdateStmt

type UpdateStmt struct {
	Database   string
	Table      string
	Conditions primitive.Group
	Values     []primitive.KV
	Sorts      []any
	RowCount   uint
}

UpdateStmt :

func Update

func Update[T ~string | primitive.Pair](src T) *UpdateStmt

Update :

func (*UpdateStmt) Limit

func (stmt *UpdateStmt) Limit(num uint) *UpdateStmt

Limit :

func (*UpdateStmt) OrderBy

func (stmt *UpdateStmt) OrderBy(fields ...any) *UpdateStmt

OrderBy :

func (*UpdateStmt) Set

func (stmt *UpdateStmt) Set(values ...primitive.KV) *UpdateStmt

Set :

func (*UpdateStmt) Where

func (stmt *UpdateStmt) Where(fields ...any) *UpdateStmt

Where :

Directories

Path Synopsis
sql

Jump to

Keyboard shortcuts

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