mysqlcolumns

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2019 License: MIT, MIT Imports: 5 Imported by: 0

README

Mysql columns Mysql列信息驱动

从mysql连接中获取mysql表列信息的驱动

使用方式

import _ github.com/herb/model/sql/db/columns
import _ github.com/herb/model/sql/db/columns/mysqlcolumns

columns,err:=columns.Driver("mysql")
支持的字段类型
  • TINYINT =>byte
  • BIT =>byte
  • BOOL =>byte
  • SMALLINT =>int
  • MEDIUMINT =>int
  • INT =>int
  • INTEGER =>int
  • BIGINT =>int64
  • FLOAT =>float32
  • DOUBLE =>float64
  • DOUBLE PRECISION =>float64
  • DATETIME =>time.Time
  • TIMESTAMP =>time.Time
  • CHAR =>string
  • VARCHAR =>string
  • TINYTEXT =>string
  • TEXT =>string
  • MEDIUMTEXT =>string
  • LONGTEXT =>string
  • BINARY =>[]byte
  • VARBINARY =>[]byte
  • TINYBLOB =>[]byte
  • BLOB =>[]byte
  • MEDIUMBLOB =>[]byte
  • LONGBLOB =>[]byte

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertType

func ConvertType(t string) (string, error)

ConvertType convert culumn type to golang type.

Types

type Column

type Column struct {
	// Field  column name
	Field string
	// Type column type
	Type string
	// IsNull if column can be null
	IsNull string
	// Key  if column is primary key
	Key string
	// Default default value
	Default interface{}
	// Extra extra data
	Extra string
}

Column mysql column struct

func (*Column) Convert

func (c *Column) Convert() (*columns.Column, error)

Convert convert MysqlColumn to commn column

type Columns

type Columns []Column

Columns mysql columns type

func (*Columns) Columns

func (c *Columns) Columns() ([]*columns.Column, error)

Columns return loaded columns

func (*Columns) Load

func (c *Columns) Load(conn db.Database, table string) error

Load load columns with given database and table name

Jump to

Keyboard shortcuts

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