ansi

package
v0.0.0-...-f5e2a81 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2013 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

ansi package is keywords, datatyp, schema of ansi sql

Index

Constants

View Source
const (
	Split          = "."
	StatementSplit = ";"
	WildcardAll    = "*"
	WildcardAny    = "%"
	WildcardOne    = "_"
	Blank          = " "
	Comma          = ","
	LineBreak      = "\n"

	Select     = "SELECT"
	Top        = "TOP"
	Distinct   = "DISTINCT"
	From       = "FROM"
	Where      = "WHERE"
	GroupBy    = "GROUP BY"
	Having     = "HAVING"
	OrderBy    = "ORDER BY"
	Asc        = "ASC"
	Desc       = "DESC"
	Limit      = "LIMIT"
	Insert     = "INSERT"
	InsertInto = "INSERT INTO"
	Values     = "VALUES"
	Update     = "UPDATE"
	Set        = "SET"
	Delete     = "DELETE"
	Output     = "OUTPUT"
	Using      = "USING"

	Join      = "JOIN"
	As        = "AS"
	On        = "ON"
	CrossJoin = "CROSS JOIN"
	FullJoin  = "FULL JOIN"
	InnerJoin = "INNER JOIN"
	OuterJoin = "OUTER JOIN"
	LeftJoin  = "LEFT JOIN"
	RightJoin = "RIGHT JOIN"

	And              = "AND"
	Or               = "OR"
	OpenParentheses  = "("
	CloseParentheses = ")"
	Null             = "NULL"
	IsNull           = "IS NULL"
	IsNotNull        = "IS NOT NULL"
	Is               = "IS"
	IsNot            = "IS NOT"
	LessThan         = "<"
	LessOrEquals     = "<="
	GreaterThan      = ">"
	GreaterOrEquals  = ">="
	Equals           = "="
	NotEquals        = "<>"
	Between          = "BETWEEN"
	Like             = "LIKE"
	NotLike          = "NOT LIKE"
	In               = "IN"
	NotIn            = "NOT IN"
	All              = "ALL"
	Some             = "SOME"
	Any              = "ANY"
	Exists           = "EXISTS"
	NotExists        = "NOT EXISTS"

	Count = "COUNT"
	Sum   = "SUM"
	Avg   = "AVG"
	Min   = "MIN"
	Max   = "MAX"

	BeginTran = "BEGIN TRAN"
	Commit    = "COMMIT"
	Rollback  = "ROLLBACK"
)
View Source
const (
	Zero     DbType = 0
	String   DbType = 1
	Boolean  DbType = 2
	Bytes    DbType = 3
	Date     DbType = 4
	DateTime DbType = 5
	Guid     DbType = 6

	Int     = 11
	Numeric = 12
	Float   = 13

	Var = 21
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbColumn

type DbColumn struct {
	// Name is column name
	Name string

	// Position is position in table
	Position int

	// DbType is data type of this column
	DbType DbType

	// NativeType is native data type
	NativeType string

	// Precision
	Precision int

	// Scale
	Scale int

	// Size
	Size int

	// IsNullable
	IsNullable bool

	// IsAutoIncrement
	IsAutoIncrement bool

	// IsReadOnly
	IsReadOnly bool

	// IsPrimaryKey
	IsPrimaryKey bool
}

DbColumn is schema of column

type DbFunction

type DbFunction struct {
	// Name is name of procedure
	Name string

	// Catalog
	Catalog string

	// Schema
	Schema string

	// Parameters is parameters of this procedure
	Parameters []DbParameter
}

DbFunction is schema of procedure / function

func NewFunction

func NewFunction() *DbFunction

func (*DbFunction) String

func (f *DbFunction) String() string

type DbParameter

type DbParameter struct {
	// Name
	Name string

	// Position is position in procedure
	Position int

	// DbType is data type of parameter
	DbType DbType

	// NativeType is native data type
	NativeType string

	// Dir is parameter direction
	Dir Dir

	// Precision
	Precision int

	// Scale
	Scale int

	// Size
	Size int
}

DbParameter is schema of procedure parameter

type DbTable

type DbTable struct {
	// Name is table name
	Name string

	// Catalog is catalog name
	Catalog string

	// Schema is schema name
	Schema string

	// Type is table,view,...
	Type string

	// Columns is columns of this table
	Columns []DbColumn
}

DbTable is schema of table

func NewTable

func NewTable() *DbTable

func (*DbTable) String

func (t *DbTable) String() string

type DbType

type DbType int

DbType is data type of sql engine

func (DbType) HasLength

func (t DbType) HasLength() bool

HasLength return true if t is string or bytes

func (DbType) HasPrecisionAndScale

func (t DbType) HasPrecisionAndScale() bool

HasPrecisionAndScale return true if t is Float,Numeric

func (DbType) IsBoolean

func (t DbType) IsBoolean() bool

IsBoolean return true if t is Boolean

func (DbType) IsDateTime

func (t DbType) IsDateTime() bool

IsDateTime return true if t is Date,DateTime

func (DbType) IsFloat

func (t DbType) IsFloat() bool

IsFloat return true if t is Float

func (DbType) IsInteger

func (t DbType) IsInteger() bool

IsInteger return true if t is Int

func (DbType) IsNumeric

func (t DbType) IsNumeric() bool

IsNumeric return true if t is Float,Int,Numeric

func (DbType) IsString

func (t DbType) IsString() bool

IsString return true if t is String

func (DbType) String

func (t DbType) String() string

String

type Dir

type Dir int

Dir is direction of parameter

const (
	DirIn     Dir = 0
	DirOut    Dir = 1
	DirInOut  Dir = 2
	DirReturn Dir = 3
)

func (Dir) String

func (d Dir) String() string

String

type Schemaer

type Schemaer interface {
	// Table return schema of table
	Table(name string) DbTable

	// Procedure return schema of procedure
	Procedure(name string) DbTable
}

Schemaer is interface of database schema provider

Jump to

Keyboard shortcuts

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