Documentation ¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetInfo(name string) (os.FileInfo, error)
- func AssetNames() []string
- func MustAsset(name string) []byte
- func NullableBool(value bool) *bool
- func NullableInt32(value int32) *int32
- func NullableInt64(value int64) *int64
- func NullableString(value string) *string
- func NullableTime(value time.Time) *time.Time
- func RestoreAsset(dir, name string) error
- func RestoreAssets(dir, name string) error
- type Cassandra
- type CockroachDBBatch
- type Column
- type DataType
- type Direction
- type ExtraField
- type Index
- type IndexCombination
- type Postgres
- type Schema
- func (s *Schema) Generate(dir string, logging bool, generatorNames ...string) []error
- func (s *Schema) LoaderImports() map[string]bool
- func (s *Schema) NewTable(dbTableName string, goTableName string, structName string) *Table
- func (s *Schema) ReadExtraFieldsFile(filename string, log func(msg string, args ...interface{})) error
- func (s *Schema) SortedTables() []*Table
- func (s *Schema) Validate(generators []generator) []error
- type Table
- func (t *Table) AddColumn(dbName string, goName string, dataType DataType, nullable bool)
- func (t *Table) AddIndex(name string, columns ...string) *Index
- func (t *Table) AutoIDColumn() *Column
- func (t *Table) GetColumn(name string) *Column
- func (t *Table) IndexCombinations() []*IndexCombination
- func (t *Table) NonAutoIDColumns() []*Column
- func (t *Table) SetPrimaryIndex(columns ...string)
- func (t *Table) Validate(generators []generator) []error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Asset ¶
Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.
func AssetDir ¶
AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:
data/ foo.txt img/ a.png b.png
then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.
func AssetInfo ¶
AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.
func MustAsset ¶
MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.
func NullableBool ¶
NullableBool returns a pointer to the given value, and is useful for inline values to methods that require pointer values for nullable columns. E.g., table.Insert(dbkit.NullableBool(false))
func NullableInt32 ¶
NullableInt32 returns a pointer to the given value, and is useful for inline values to methods that require pointer values for nullable columns. E.g., table.Insert(dbkit.NullableInt32(345))
func NullableInt64 ¶
NullableInt64 returns a pointer to the given value, and is useful for inline values to methods that require pointer values for nullable columns. E.g., table.Insert(dbkit.NullableInt64(345))
func NullableString ¶
NullableString returns a pointer to the given value, and is useful for inline values to methods that require pointer values for nullable columns. E.g., table.Insert(dbkit.NullableString("somevalue"))
func NullableTime ¶
NullableTime returns a pointer to the given value, and is useful for inline values to methods that require pointer values for nullable columns. E.g., table.Insert(dbkit.NullableTime(time.Now()))
func RestoreAsset ¶
RestoreAsset restores an asset under the given directory
func RestoreAssets ¶
RestoreAssets restores an asset under the given directory recursively
Types ¶
type CockroachDBBatch ¶
type DataType ¶
type DataType int
DataType represents the various data types allowed for table columns
const ( // DataTypeAutoID maps to an auto increment id or closest matching construct in the database. A table can only have one AutoID columns and it must be the only column in the primary key. DataTypeAutoID DataType = iota // DataTypeInt64 is a 64bit integer value DataTypeInt64 // DataTypeInt32 is a 32bit integer value DataTypeInt32 // DataTypeFloat64 is a 64bit floating-point number DataTypeFloat64 // DataTypeString is a string value DataTypeString // DataTypeTime is a time value (date+time) DataTypeTime // DataTypeDate is a date value (date) DataTypeDate // DataTypeBytes is a bytes value ([]byte) DataTypeBytes // DataTypeBool is a boolean value DataTypeBool // DataTypeTimeUUID is a TimeUUID value DataTypeTimeUUID // DataTypeTimeUUID is a UUID value DataTypeUUID // DataTypeJSON is a JSON value DataTypeJSON // DataTypeStringArray is a string array DataTypeStringArray )
type Direction ¶
type Direction int
Direction represents a sort order for a query (ascending or descending)
type ExtraField ¶
ExtraField represents an extra go field added to the generated struct for a given table
type Index ¶
Index represents an index in a database table
func (*Index) LoaderKeyFromStruct ¶
func (*Index) LoaderKeyFuncArgs ¶
func (*Index) LoaderKeyFuncValue ¶
func (*Index) LoaderKeyGoType ¶
func (*Index) LoaderKeyUnpack ¶
type IndexCombination ¶
type IndexCombination struct { Name string FuncArgs string CallArgs string Columns []*Column Table Table }
IndexCombination is a column combinations suitable for index lookup.
type Schema ¶
Schema represents a database schema
func (*Schema) LoaderImports ¶
func (*Schema) ReadExtraFieldsFile ¶
func (*Schema) SortedTables ¶
type Table ¶
type Table struct { DBTableName string GoTableName string GoLowerTableName string StructName string LowerStructName string Columns []*Column ExtraFields []*ExtraField Indexes map[string]*Index PrimaryIndex *Index Logging bool }
Table represents a table in a database schema
func (*Table) AutoIDColumn ¶
AutoIDColumn returns the AutoID column of the table (if any)
func (*Table) IndexCombinations ¶
func (t *Table) IndexCombinations() []*IndexCombination
IndexCombinations builds a list of column combinations suitable for index lookups.
func (*Table) NonAutoIDColumns ¶
NonAutoIDColumns builds a slice of columns that aren't of type AutoID
func (*Table) SetPrimaryIndex ¶
SetPrimaryIndex sets the primary index on the table