mysqlxclient

package
v0.0.0-...-86f4e66 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXPR_TYPE_COLUMN_NAME   = mysqlxpb_expr.Expr_IDENT
	EXPR_TYPE_LITERAL       = mysqlxpb_expr.Expr_LITERAL
	EXPR_TYPE_OPERATOR      = mysqlxpb_expr.Expr_OPERATOR
	EXPR_TYPE_FUNCTION_CALL = mysqlxpb_expr.Expr_FUNC_CALL
)
View Source
const (
	COLUMN_FLAG_NOT_NULL       uint32 = 0x0010
	COLUMN_FLAG_PRIMARY_KEY    uint32 = 0x0020
	COLUMN_FLAG_UNIQUE_KEY     uint32 = 0x0040
	COLUMN_FLAG_MULTIPLE_KEY   uint32 = 0x0080
	COLUMN_FLAG_AUTO_INCREMENT uint32 = 0x0100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthType

type AuthType int
const (
	AUTH_TYPE_MYSQL41 AuthType = iota
	AUTH_TYPE_PLAIN
)

type Client

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

func NewClient

func NewClient(cfg *ClientCfg) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Delete

func (c *Client) Delete(da *DeleteArgs) (uint64, error)

func (*Client) Find

func (c *Client) Find(fa *FindArgs) (*FindResultSet, error)

func (*Client) Insert

func (c *Client) Insert(ia *InsertArgs) (uint64, uint64, error)

func (*Client) Update

func (c *Client) Update(ua *UpdateArgs) (uint64, error)

type ClientCfg

type ClientCfg struct {
	Addr     string
	Username string
	Password string
	DbName   string
	Location *time.Location
	AuthType AuthType

	InitialConns uint
	MaxConns     uint
	OnTCPDial    func(tc *net.TCPConn) error
	DialTimeout  time.Duration
	ReadTimeout  time.Duration
	WriteTimeout time.Duration
	IdleTimeout  time.Duration
	Tls          *tls.Config
	Log          func(isErr bool, msg string)
}

type ColumnDataType

type ColumnDataType uint8
const (
	COLUMN_DATA_TYPE_BIT  ColumnDataType
	COLUMN_DATA_TYPE_SINT // int64
	COLUMN_DATA_TYPE_UINT
	COLUMN_DATA_TYPE_FLOAT
	COLUMN_DATA_TYPE_DOUBLE
	COLUMN_DATA_TYPE_BYTES
	COLUMN_DATA_TYPE_ENUM
	COLUMN_DATA_TYPE_SET
	COLUMN_DATA_TYPE_TIME
	COLUMN_DATA_TYPE_DATETIME
	COLUMN_DATA_TYPE_DECIMAL
	COLUMN_DATA_TYPE_GEOMETRY
)

type ColumnMeta

type ColumnMeta struct {
	DataType ColumnDataType
	Name     string
	Flag     uint32
}

type Criteria

type Criteria struct {
	Where  *Expr
	Orders []Order
	Limit  uint64
	Offset uint64
}

type DeleteArgs

type DeleteArgs struct {
	TableName string
	Criteria  *Criteria
}

type Expr

type Expr struct {
	Type  ExprType
	Name  string
	Value interface{}
	Args  []*Expr
}

func ExprFromColumnName

func ExprFromColumnName(name string) *Expr

func ExprFromFunctionCall

func ExprFromFunctionCall(function string, args ...*Expr) *Expr

func ExprFromLiteral

func ExprFromLiteral(x interface{}) *Expr

func ExprFromOperator

func ExprFromOperator(operator string, args ...*Expr) *Expr

func ExprFromOperatorWithColumnNameAndLiteral

func ExprFromOperatorWithColumnNameAndLiteral(columnName string, operator string, value interface{}) *Expr

type ExprType

type ExprType = mysqlxpb_expr.Expr_Type

type FindArgs

type FindArgs struct {
	TableName string
	Select    []*FindSelectItem
	Criteria  *Criteria
	Groups    []*Expr
	Having    *Expr
}

type FindResultSet

type FindResultSet struct {
	Meta []*ColumnMeta
	Rows [][]interface{}
}

type FindSelectItem

type FindSelectItem struct {
	Expr *Expr
	As   string
}

func FindSelectItemsFromColumnNames

func FindSelectItemsFromColumnNames(columnNames []string) []*FindSelectItem

type InsertArgs

type InsertArgs struct {
	TableName string
	Columns   []string
	Values    [][]interface{}
}

type MysqlError

type MysqlError struct {
	Code uint32
	Msg  string
}

func (MysqlError) Error

func (e MysqlError) Error() string

type Order

type Order struct {
	By  *Expr
	Asc bool
}

type UpdateArgs

type UpdateArgs struct {
	TableName string
	Values    map[string]interface{}
	Criteria  *Criteria
}

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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