mysql

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ERR_PARAMETER = "err_parameter"
View Source
var ERR_SQL_EXECUTION = "err_sql_execution"
View Source
var ERR_SQL_RESULTS = "err_sql_results"

Functions

This section is empty.

Types

type ColumnMetadata

type ColumnMetadata struct {
	ColumnName string `json:"column_name,omitempty"` // column name or code ?
	ColumnType string `json:"column_type,omitempty"` // column type
	NullAble   string `json:"nullable,omitempty"`    // column null able

	// If Key is MUL, multiple occurrences of a given value are
	// permitted within the column. The column is the first column
	// of a nonunique index or a unique-valued index that can contain
	// NULL values.
	Key              string `json:"key,omitempty"`           // column key type
	DefaultValue     string `json:"default_value,omitempty"` // default value if have
	Extra            string `json:"extra,omitempty"`         // extra info, for example, auto_increment
	OridinalSequence int64  `json:"oridinal_sequence,omitempty"`
	DataType         string `json:"data_type,omitempty"`
	Comment          string `json:"comment,omitempty"`
}

ColumnMetadata metadata of a column

func (*ColumnMetadata) GetDefaultValue

func (c *ColumnMetadata) GetDefaultValue() (v interface{})

func (ColumnMetadata) MarshalEasyJSON

func (v ColumnMetadata) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ColumnMetadata) MarshalJSON

func (v ColumnMetadata) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ColumnMetadata) UnmarshalEasyJSON

func (v *ColumnMetadata) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ColumnMetadata) UnmarshalJSON

func (v *ColumnMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type DataBaseMetadata

type DataBaseMetadata struct {
	DatabaseName string           `json:"database_name,omitempty"` // database name
	Tables       []*TableMetadata `json:"tables,omitempty"`        // collection of tables
}

DataBaseMetadata metadata of a database

func (*DataBaseMetadata) GetSimpleMetadata

func (d *DataBaseMetadata) GetSimpleMetadata() (rt map[string]interface{})

GetSimpleMetadata

func (*DataBaseMetadata) GetTableMeta

func (d *DataBaseMetadata) GetTableMeta(tableName string) *TableMetadata

GetTableMeta

func (*DataBaseMetadata) HaveTable

func (d *DataBaseMetadata) HaveTable(sTableName string) bool

HaveTable

func (DataBaseMetadata) MarshalEasyJSON

func (v DataBaseMetadata) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (DataBaseMetadata) MarshalJSON

func (v DataBaseMetadata) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*DataBaseMetadata) TableHaveField

func (d *DataBaseMetadata) TableHaveField(sTableName string, sFieldName string) bool

TableHaveField

func (*DataBaseMetadata) UnmarshalEasyJSON

func (v *DataBaseMetadata) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*DataBaseMetadata) UnmarshalJSON

func (v *DataBaseMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ErrorMessage

type ErrorMessage struct {
	ErrorTitle       string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

ErrorMessage

func (*ErrorMessage) Error

func (em *ErrorMessage) Error() string

Error makes it compatible with `error` interface.

func (ErrorMessage) MarshalEasyJSON

func (v ErrorMessage) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ErrorMessage) MarshalJSON

func (v ErrorMessage) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ErrorMessage) UnmarshalEasyJSON

func (v *ErrorMessage) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ErrorMessage) UnmarshalJSON

func (v *ErrorMessage) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Paginator

type Paginator struct {
	PageIndex  int         `json:"pageIndex"`
	PageSize   int         `json:"pageSize"`
	TotalPages int         `json:"totalPages"`
	TotalCount int         `json:"totalCount"`
	Data       interface{} `json:"data"`
}

func (Paginator) MarshalEasyJSON

func (v Paginator) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Paginator) MarshalJSON

func (v Paginator) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Paginator) UnmarshalEasyJSON

func (v *Paginator) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Paginator) UnmarshalJSON

func (v *Paginator) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type QueryOption

type QueryOption struct {
	Table  string                    // table name
	Id     string                    // select with primary key value
	Index  int                       // start page
	Limit  int                       // record limit
	Offset int                       // start offset
	Fields []string                  // select fields
	Links  []string                  // auto join table
	Wheres map[string]WhereOperation // field -> { operation, value }
	Search string                    // fuzzy query word
}

QueryConfig for Select method

func (QueryOption) MarshalEasyJSON

func (v QueryOption) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (QueryOption) MarshalJSON

func (v QueryOption) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*QueryOption) UnmarshalEasyJSON

func (v *QueryOption) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*QueryOption) UnmarshalJSON

func (v *QueryOption) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type TableMetadata

type TableMetadata struct {
	TableName    string            `json:"table_name,omitempty"` //Table name
	TableType    string            `json:"table_type,omitempty"`
	TableRows    int64             `json:"table_rows,omitempty"`
	CurrentIncre int64             `json:"current_increment,omitempty"`
	Comment      string            `json:"comment,omitempty"`
	Columns      []*ColumnMetadata `json:"columns,omitempty"` //collections of column
}

TableMetadata metadata of a Table

func (*TableMetadata) GetPrimaryColumns

func (t *TableMetadata) GetPrimaryColumns() (primaryColumns []*ColumnMetadata)

GetPrimaryColumn

func (t *TableMetadata) GetPrimaryColumn() *ColumnMetadata {
	primaryColumns:=t.GetPrimaryColumns()
	if(len(primaryColumns)>0){
		return primaryColumns[0]
	}
	return nil
}

GetPrimaryColumns

func (*TableMetadata) HaveField

func (t *TableMetadata) HaveField(sFieldName string) bool

HaveField

func (TableMetadata) MarshalEasyJSON

func (v TableMetadata) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (TableMetadata) MarshalJSON

func (v TableMetadata) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*TableMetadata) UnmarshalEasyJSON

func (v *TableMetadata) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*TableMetadata) UnmarshalJSON

func (v *TableMetadata) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type WhereOperation

type WhereOperation struct {
	Operation string
	Value     interface{}
}

func (WhereOperation) MarshalEasyJSON

func (v WhereOperation) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (WhereOperation) MarshalJSON

func (v WhereOperation) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*WhereOperation) UnmarshalEasyJSON

func (v *WhereOperation) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*WhereOperation) UnmarshalJSON

func (v *WhereOperation) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

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