mysqlconfig

package
v0.2.1-0...-d023f04 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildColumnMapIndex

func BuildColumnMapIndex(from []string, ordinals ColumnsMap) (mapIndex []int, err error)

func BuildInsertColumnList

func BuildInsertColumnList(columnNames []string) string

func ConvertFromUTF8

func ConvertFromUTF8(s string, charset string) (string, error)

func ConvertToUTF8

func ConvertToUTF8(s string, charset string) (string, error)

return original string and error if charset is not recognized

func EscapeName

func EscapeName(name string) string

func EscapeNameSlice

func EscapeNameSlice(names []string) (r []string)

Types

type Column

type Column struct {
	// Every time you set this, you must also set `EscapedName`.
	RawName     string
	EscapedName string
	IsUnsigned  bool
	Charset     string
	Type        ColumnType
	// Default is currently only used for kafka and limited to basic types.
	Default            interface{}
	ColumnType         string
	Key                string
	TimezoneConversion *TimezoneConvertion
	Nullable           bool
	Precision          int // for decimal, time or datetime
	Scale              int // for decimal

}

func NewColumns

func NewColumns(names []string) []Column

func ParseColumns

func ParseColumns(names string) []Column

func (*Column) ConvertArg

func (c *Column) ConvertArg(arg interface{}) interface{}

type of arg: see type.schema

func (*Column) IsPk

func (c *Column) IsPk() bool

type ColumnType

type ColumnType int
const (
	UnknownColumnType ColumnType = iota
	TimestampColumnType
	DateTimeColumnType
	EnumColumnType
	MediumIntColumnType
	BigIntColumnType
	FloatColumnType
	DoubleColumnType
	DecimalColumnType
	BinaryColumnType
	TextColumnType // 10
	JSONColumnType

	DateColumnType
	TimeColumnType
	YearColumnType

	VarbinaryColumnType

	BitColumnType
	TinytextColumnType
	TinyintColumnType
	SmallintColumnType
	IntColumnType // 20
	SetColumnType
	CharColumnType
	VarcharColumnType
	BlobColumnType
	BooleanColumnType
)

type ColumnsMap

type ColumnsMap map[string]int

ColumnsMap maps a column name onto its ordinal position

func NewColumnsMap

func NewColumnsMap(orderedColumns []Column) ColumnsMap

type ConnectionConfig

type ConnectionConfig struct {
	Host     string
	Port     int
	User     string
	Password string
	Charset  string
}

ConnectionConfig is the minimal configuration required to connect to a MySQL server

func (*ConnectionConfig) GetAddr

func (c *ConnectionConfig) GetAddr() string

func (*ConnectionConfig) GetDBUri

func (c *ConnectionConfig) GetDBUri() string

type LowerCaseTableNamesValue

type LowerCaseTableNamesValue int
const (
	LowerCaseTableNames0 LowerCaseTableNamesValue = iota
	LowerCaseTableNames1
	LowerCaseTableNames2
)

type TimezoneConvertion

type TimezoneConvertion struct {
	ToTimezone string
}

Jump to

Keyboard shortcuts

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