columns

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: 2 Imported by: 0

README

Columns 数据库列信息组件

根据数据库配置获取数据库列信息的组件

数据库列结构

Column是数据库的每一列的信息

type Column struct {
    Field      string
    ColumnType string
    AutoValue  bool
    PrimayKey  bool
    NotNull    bool
}
  • Field 列名
  • ColumnType 列对应的变量类型
  • AutoValue 列是否是自动赋值的
  • PrimayKey 是否是主键
  • NotNull 列是否为非空

使用方式

columns,err:=culumns.Driver("drivername")

可用驱动

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(name string, loader func() Loader)

Register register columns loader with given name

Types

type Column

type Column struct {
	//Field column name
	Field string
	//ColumnType golang type mapped to column data
	ColumnType string
	//AutoValue  if value is auto created
	AutoValue bool
	//PrimayKey if column is primay key
	PrimayKey bool
	//NotNull if column is not null column
	NotNull bool
}

Column sql column info

type Loader

type Loader interface {
	// Columns return loaded columns
	Columns() ([]*Column, error)
	// Load load columns with given database and table name
	Load(conn db.Database, table string) error
}

Loader loader which load columns info

func Driver

func Driver(name string) (Loader, error)

Driver get driver with given name

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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