mysql

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// INT_WIDTH_DEFAULT records the default width of integer type
	INT_WIDTH_DEFAULT = map[string]int{
		"TINYINT":  4,
		"SMALLINT": 6,
		"INT":      11,
		"BIGINT":   20,
	}
	// UNSIGNED_INT_WIDTH_DEFAULT records the default width of unsigned integer type
	UNSIGNED_INT_WIDTH_DEFAULT = map[string]int{
		"TINYINT":  3,
		"SMALLINT": 5,
		"INT":      10,
		"BIGINT":   20,
	}
)

Functions

This section is empty.

Types

type CompoundColumn

type CompoundColumn struct {
	STextColumn
	sqlchemy.SBaseCompoundColumn
}

CompoundColumn represents a column of compound tye, e.g. a JSON, an Array, or a struct

func NewCompoundColumn

func NewCompoundColumn(name string, sqlType string, tagmap map[string]string, isPointer bool) CompoundColumn

NewCompoundColumn returns an instance of CompoundColumn

func (*CompoundColumn) ConvertFromString

func (c *CompoundColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of CompoundColumn for IColumnSpec

func (*CompoundColumn) ConvertFromValue

func (c *CompoundColumn) ConvertFromValue(val interface{}) interface{}

ConvertFromValue implementation of CompoundColumn for IColumnSpec

func (*CompoundColumn) DefinitionString

func (c *CompoundColumn) DefinitionString() string

DefinitionString implementation of CompoundColumn for IColumnSpec

func (*CompoundColumn) IsZero

func (c *CompoundColumn) IsZero(val interface{}) bool

IsZero implementation of CompoundColumn for IColumnSpec

type SBooleanColumn

type SBooleanColumn struct {
	sqlchemy.SBaseWidthColumn
}

SBooleanColumn represents a boolean type column, which is a int(1) for mysql, with value of true or false

func NewBooleanColumn

func NewBooleanColumn(name string, tagmap map[string]string, isPointer bool) SBooleanColumn

NewBooleanColumn return an instance of SBooleanColumn

func (*SBooleanColumn) ConvertFromString

func (c *SBooleanColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*SBooleanColumn) ConvertFromValue

func (c *SBooleanColumn) ConvertFromValue(val interface{}) interface{}

ConvertFromValue implementation of STristateColumn for IColumnSpec

func (*SBooleanColumn) DefinitionString

func (c *SBooleanColumn) DefinitionString() string

DefinitionString implementation of SBooleanColumn for IColumnSpec

func (*SBooleanColumn) IsZero

func (c *SBooleanColumn) IsZero(val interface{}) bool

IsZero implementation of SBooleanColumn for IColumnSpec

type SDateTimeColumn

type SDateTimeColumn struct {
	STimeTypeColumn
	// contains filtered or unexported fields
}

SDateTimeColumn represents a DateTime type of column

func NewDateTimeColumn

func NewDateTimeColumn(name string, tagmap map[string]string, isPointer bool) SDateTimeColumn

NewDateTimeColumn returns an instance of DateTime column

func (*SDateTimeColumn) IsCreatedAt

func (c *SDateTimeColumn) IsCreatedAt() bool

func (*SDateTimeColumn) IsDateTime

func (c *SDateTimeColumn) IsDateTime() bool

func (*SDateTimeColumn) IsUpdatedAt

func (c *SDateTimeColumn) IsUpdatedAt() bool

type SDecimalColumn

type SDecimalColumn struct {
	sqlchemy.SBaseWidthColumn
	Precision int
}

SDecimalColumn represents a DECIMAL type of column, i.e. a float with fixed width of digits

func NewDecimalColumn

func NewDecimalColumn(name string, tagmap map[string]string, isPointer bool) SDecimalColumn

NewDecimalColumn returns an instance of SDecimalColumn

func (*SDecimalColumn) ColType

func (c *SDecimalColumn) ColType() string

ColType implementation of SDecimalColumn for IColumnSpec

func (*SDecimalColumn) ConvertFromString

func (c *SDecimalColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*SDecimalColumn) DefinitionString

func (c *SDecimalColumn) DefinitionString() string

DefinitionString implementation of SDecimalColumn for IColumnSpec

func (*SDecimalColumn) IsNumeric

func (c *SDecimalColumn) IsNumeric() bool

IsNumeric implementation of SDecimalColumn for IColumnSpec

func (*SDecimalColumn) IsZero

func (c *SDecimalColumn) IsZero(val interface{}) bool

IsZero implementation of SDecimalColumn for IColumnSpec

type SFloatColumn

type SFloatColumn struct {
	sqlchemy.SBaseColumn
}

SFloatColumn represents a float type column, e.g. float32 or float64

func NewFloatColumn

func NewFloatColumn(name string, sqlType string, tagmap map[string]string, isPointer bool) SFloatColumn

NewFloatColumn returns an instance of SFloatColumn

func (*SFloatColumn) ConvertFromString

func (c *SFloatColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*SFloatColumn) DefinitionString

func (c *SFloatColumn) DefinitionString() string

DefinitionString implementation of SFloatColumn for IColumnSpec

func (*SFloatColumn) IsNumeric

func (c *SFloatColumn) IsNumeric() bool

IsNumeric implementation of SFloatColumn for IColumnSpec

func (*SFloatColumn) IsZero

func (c *SFloatColumn) IsZero(val interface{}) bool

IsZero implementation of SFloatColumn for IColumnSpec

type SIntegerColumn

type SIntegerColumn struct {
	sqlchemy.SBaseWidthColumn
	// contains filtered or unexported fields
}

SIntegerColumn represents an integer type of column, with value of integer

func NewIntegerColumn

func NewIntegerColumn(name string, sqltype string, unsigned bool, tagmap map[string]string, isPointer bool) SIntegerColumn

NewIntegerColumn return an instance of SIntegerColumn

func (*SIntegerColumn) AutoIncrementOffset

func (c *SIntegerColumn) AutoIncrementOffset() int64

func (*SIntegerColumn) ColType

func (c *SIntegerColumn) ColType() string

ColType implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) ConvertFromString

func (c *SIntegerColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*SIntegerColumn) DefinitionString

func (c *SIntegerColumn) DefinitionString() string

DefinitionString implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) ExtraDefs

func (c *SIntegerColumn) ExtraDefs() string

ExtraDefs implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) IsAutoIncrement

func (c *SIntegerColumn) IsAutoIncrement() bool

func (*SIntegerColumn) IsAutoVersion

func (c *SIntegerColumn) IsAutoVersion() bool

func (*SIntegerColumn) IsNumeric

func (c *SIntegerColumn) IsNumeric() bool

IsNumeric implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) IsZero

func (c *SIntegerColumn) IsZero(val interface{}) bool

IsZero implementation of SIntegerColumn for IColumnSpec

func (*SIntegerColumn) SetAutoIncrement

func (c *SIntegerColumn) SetAutoIncrement(on bool)

func (*SIntegerColumn) SetAutoIncrementOffset

func (c *SIntegerColumn) SetAutoIncrementOffset(offset int64)

type SMySQLBackend

type SMySQLBackend struct {
	sqlchemy.SBaseBackend
}

func (*SMySQLBackend) CanInsert

func (mysql *SMySQLBackend) CanInsert() bool

CanInsert returns wether the backend supports Insert

func (*SMySQLBackend) CanInsertOrUpdate

func (mysql *SMySQLBackend) CanInsertOrUpdate() bool

CanInsertOrUpdate returns weather the backend supports InsertOrUpdate

func (*SMySQLBackend) CanUpdate

func (mysql *SMySQLBackend) CanUpdate() bool

CanUpdate returns wether the backend supports update

func (*SMySQLBackend) CommitTableChangeSQL

func (mysql *SMySQLBackend) CommitTableChangeSQL(ts sqlchemy.ITableSpec, changes sqlchemy.STableChanges) []string

func (*SMySQLBackend) CurrentTimeStampString added in v1.1.2

func (mysql *SMySQLBackend) CurrentTimeStampString() string

func (*SMySQLBackend) CurrentUTCTimeStampString added in v1.1.2

func (mysql *SMySQLBackend) CurrentUTCTimeStampString() string

func (*SMySQLBackend) FetchIndexesAndConstraints

func (mysql *SMySQLBackend) FetchIndexesAndConstraints(ts sqlchemy.ITableSpec) ([]sqlchemy.STableIndex, []sqlchemy.STableConstraint, error)

func (*SMySQLBackend) FetchTableColumnSpecs

func (mysql *SMySQLBackend) FetchTableColumnSpecs(ts sqlchemy.ITableSpec) ([]sqlchemy.IColumnSpec, error)

func (*SMySQLBackend) GROUP_CONCAT2 added in v1.1.2

func (mysql *SMySQLBackend) GROUP_CONCAT2(name string, sep string, field sqlchemy.IQueryField) sqlchemy.IQueryField

GROUP_CONCAT2 represents the SQL function GROUP_CONCAT

func (*SMySQLBackend) GetColumnSpecByFieldType

func (mysql *SMySQLBackend) GetColumnSpecByFieldType(table *sqlchemy.STableSpec, fieldType reflect.Type, fieldname string, tagmap map[string]string, isPointer bool) sqlchemy.IColumnSpec

func (*SMySQLBackend) GetCreateSQLs

func (mysql *SMySQLBackend) GetCreateSQLs(ts sqlchemy.ITableSpec) []string

func (*SMySQLBackend) InsertOrUpdateSQLTemplate

func (mysql *SMySQLBackend) InsertOrUpdateSQLTemplate() string

func (*SMySQLBackend) IsSupportIndexAndContraints

func (msyql *SMySQLBackend) IsSupportIndexAndContraints() bool

func (*SMySQLBackend) Name

func (mysql *SMySQLBackend) Name() sqlchemy.DBBackendName

type STextColumn

type STextColumn struct {
	sqlchemy.SBaseWidthColumn
	Charset string
}

STextColumn represents a text type of column

func NewTextColumn

func NewTextColumn(name string, sqlType string, tagmap map[string]string, isPointer bool) STextColumn

NewTextColumn return an instance of STextColumn

func (*STextColumn) ColType

func (c *STextColumn) ColType() string

ColType implementation of STextColumn for IColumnSpec

func (*STextColumn) ConvertFromString

func (c *STextColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*STextColumn) DefinitionString

func (c *STextColumn) DefinitionString() string

DefinitionString implementation of STextColumn for IColumnSpec

func (*STextColumn) IsAscii

func (c *STextColumn) IsAscii() bool

IsAscii implementation of STextColumn for IColumnSpec

func (*STextColumn) IsSearchable

func (c *STextColumn) IsSearchable() bool

IsSearchable implementation of STextColumn for IColumnSpec

func (*STextColumn) IsString

func (c *STextColumn) IsString() bool

func (*STextColumn) IsSupportDefault

func (c *STextColumn) IsSupportDefault() bool

IsSupportDefault implementation of STextColumn for IColumnSpec

func (*STextColumn) IsText

func (c *STextColumn) IsText() bool

IsText implementation of STextColumn for IColumnSpec

func (*STextColumn) IsZero

func (c *STextColumn) IsZero(val interface{}) bool

IsZero implementation of STextColumn for IColumnSpec

type STimeTypeColumn

type STimeTypeColumn struct {
	sqlchemy.SBaseColumn
}

STimeTypeColumn represents a Detetime type of column, e.g. DateTime

func NewTimeTypeColumn

func NewTimeTypeColumn(name string, typeStr string, tagmap map[string]string, isPointer bool) STimeTypeColumn

NewTimeTypeColumn return an instance of STimeTypeColumn

func (*STimeTypeColumn) ConvertFromString

func (c *STimeTypeColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of SBooleanColumn for IColumnSpec

func (*STimeTypeColumn) DefinitionString

func (c *STimeTypeColumn) DefinitionString() string

DefinitionString implementation of STimeTypeColumn for IColumnSpec

func (*STimeTypeColumn) IsText

func (c *STimeTypeColumn) IsText() bool

IsText implementation of STimeTypeColumn for IColumnSpec

func (*STimeTypeColumn) IsZero

func (c *STimeTypeColumn) IsZero(val interface{}) bool

IsZero implementation of STimeTypeColumn for IColumnSpec

type STristateColumn

type STristateColumn struct {
	sqlchemy.SBaseWidthColumn
}

STristateColumn represents a tristate type column, with value of true, false or none

func NewTristateColumn

func NewTristateColumn(table, name string, tagmap map[string]string, isPointer bool) STristateColumn

NewTristateColumn return an instance of STristateColumn

func (*STristateColumn) ConvertFromString

func (c *STristateColumn) ConvertFromString(str string) interface{}

ConvertFromString implementation of STristateColumn for IColumnSpec

func (*STristateColumn) ConvertFromValue

func (c *STristateColumn) ConvertFromValue(val interface{}) interface{}

ConvertFromValue implementation of STristateColumn for IColumnSpec

func (*STristateColumn) DefinitionString

func (c *STristateColumn) DefinitionString() string

DefinitionString implementation of STristateColumn for IColumnSpec

func (*STristateColumn) IsZero

func (c *STristateColumn) IsZero(val interface{}) bool

IsZero implementation of STristateColumn for IColumnSpec

Jump to

Keyboard shortcuts

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