Documentation
¶
Index ¶
- func Asset(name string) ([]byte, error)
- func AssetDir(name string) ([]string, error)
- func AssetNames() []string
- func FilterBindata(filter string, r func(string) ([]string, error)) []string
- func Generate(db *sql.DB, version string, opts *Options) error
- func GroupConcat(field Field) *groupConcat
- func LoadBindata(assets []string, r func(string) ([]byte, error)) []string
- func Migrate(db *sql.DB, d Dialect, steps []string) error
- type Aliasable
- type Condition
- type DeleteWhereStep
- type Dialect
- type Executable
- type Field
- type FieldBinding
- type FieldFunction
- type FieldMeta
- type Functional
- type InsertResultStep
- type InsertSetMoreStep
- type InsertSetStep
- type Int64Field
- type IntField
- type JoinCondition
- type JoinType
- type Options
- type PredicateType
- type Provenance
- type Query
- type Queryable
- type Reflectable
- type Renderable
- type SelectFromStep
- type SelectGroupByStep
- type SelectHavingStep
- type SelectJoinStep
- type SelectLimitStep
- type SelectOnStep
- type SelectOrderByStep
- type SelectWhereStep
- type Selectable
- type StringField
- type TableField
- type TableFieldBinding
- type TableLike
- type TableMeta
- type TimeField
- type UpdateSetMoreStep
- type UpdateSetStep
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 GroupConcat ¶
func GroupConcat(field Field) *groupConcat
Types ¶
type Condition ¶
type Condition struct {
Binding FieldBinding
Predicate PredicateType
}
type DeleteWhereStep ¶
type DeleteWhereStep interface {
Executable
Where(...Condition) Executable
}
func Delete ¶
func Delete(t TableLike) DeleteWhereStep
type Executable ¶
type Field ¶
type Field interface {
Aliasable
Functional
Name() string
As(string) Field
Function() FieldFunction
}
type FieldBinding ¶
type FieldBinding struct {
Field Field
Value interface{}
}
type FieldFunction ¶
type FieldFunction struct {
Child *FieldFunction
Name string
Expr string
Args []interface{}
}
type Functional ¶
type InsertResultStep ¶
type InsertSetMoreStep ¶
type InsertSetMoreStep interface {
Executable
InsertSetStep
Returning(TableField) InsertResultStep
}
type InsertSetStep ¶
type InsertSetStep interface {
SetString(StringField, string) InsertSetMoreStep
SetInt(IntField, int) InsertSetMoreStep
SetInt64(Int64Field, int64) InsertSetMoreStep
SetTime(TimeField, time.Time) InsertSetMoreStep
}
func InsertInto ¶
func InsertInto(t TableLike) InsertSetStep
type Int64Field ¶
type Int64Field interface {
TableField
Eq(value int64) Condition
IsEq(value Int64Field) JoinCondition
Gt(value int64) Condition
IsGt(value Int64Field) JoinCondition
Ge(value int64) Condition
IsGe(value Int64Field) JoinCondition
Lt(value int64) Condition
IsLt(value Int64Field) JoinCondition
Le(value int64) Condition
IsLe(value Int64Field) JoinCondition
}
func Int64 ¶
func Int64(s Selectable, name string) Int64Field
type IntField ¶
type IntField interface {
TableField
Eq(value int) Condition
IsEq(value IntField) JoinCondition
Gt(value int) Condition
IsGt(value IntField) JoinCondition
Ge(value int) Condition
IsGe(value IntField) JoinCondition
Lt(value int) Condition
IsLt(value IntField) JoinCondition
Le(value int) Condition
IsLe(value IntField) JoinCondition
}
func Int ¶
func Int(s Selectable, name string) IntField
type JoinCondition ¶
type JoinCondition struct {
Lhs, Rhs TableField
Predicate PredicateType
}
type Options ¶
type Options struct {
File string `short:"f" long:"file" description:"The path to the sqlite file"`
Url string `short:"u" long:"url" description:"The DB URL"`
Output string `short:"o" long:"output" description:"The path to save the generated objects to" required:"true"`
Package string `short:"p" long:"package" description:"The package to put the generated objects into" required:"true"`
Type string `short:"t" long:"type" description:"The type of the DB (mysql,postgres,sqlite)" required:"true"`
Schema string `short:"s" long:"schema" description:"The target DB schema (required for MySQL and Postgres)"`
Version func() `short:"V" long:"version" description:"Print sqlc version and exit"`
Dialect Dialect
}
type PredicateType ¶
type PredicateType int
const ( EqPredicate PredicateType = iota GtPredicate GePredicate LtPredicate LePredicate InPredicate )
type Provenance ¶
type Reflectable ¶
type Reflectable interface {
StringField(name string) StringField
IntField(name string) IntField
Int64Field(name string) Int64Field
TimeField(name string) TimeField
}
type Renderable ¶
type SelectFromStep ¶
type SelectFromStep interface {
From(Selectable) SelectWhereStep
}
func Select ¶
func Select(f ...Field) SelectFromStep
func SelectCount ¶
func SelectCount() SelectFromStep
type SelectGroupByStep ¶
type SelectGroupByStep interface {
GroupBy(...Field) SelectHavingStep
}
type SelectHavingStep ¶
type SelectHavingStep interface {
SelectOrderByStep
Query
}
type SelectJoinStep ¶
type SelectJoinStep interface {
Join(Selectable) SelectOnStep
LeftOuterJoin(Selectable) SelectOnStep
}
type SelectLimitStep ¶
type SelectLimitStep interface {
Query
}
type SelectOnStep ¶
type SelectOnStep interface {
On(...JoinCondition) SelectWhereStep
Query
}
type SelectOrderByStep ¶
type SelectOrderByStep interface {
OrderBy(...Field) SelectLimitStep
}
type SelectWhereStep ¶
type SelectWhereStep interface {
Query
SelectGroupByStep
SelectJoinStep
Where(conditions ...Condition) Query
}
type Selectable ¶
type Selectable interface {
Aliasable
Reflectable
IsSelectable()
}
type StringField ¶
type StringField interface {
TableField
Eq(value string) Condition
IsEq(value StringField) JoinCondition
Gt(value string) Condition
IsGt(value StringField) JoinCondition
Ge(value string) Condition
IsGe(value StringField) JoinCondition
Lt(value string) Condition
IsLt(value StringField) JoinCondition
Le(value string) Condition
IsLe(value StringField) JoinCondition
}
func String ¶
func String(s Selectable, name string) StringField
type TableField ¶
type TableField interface {
Field
Parent() Selectable
}
type TableFieldBinding ¶
type TableFieldBinding struct {
Field TableField
Value interface{}
}
type TableLike ¶
type TableLike interface {
Selectable
Name() string
As(string) Selectable
Queryable
}
type TimeField ¶
type TimeField interface {
TableField
Eq(value time.Time) Condition
IsEq(value TimeField) JoinCondition
Gt(value time.Time) Condition
IsGt(value TimeField) JoinCondition
Ge(value time.Time) Condition
IsGe(value TimeField) JoinCondition
Lt(value time.Time) Condition
IsLt(value TimeField) JoinCondition
Le(value time.Time) Condition
IsLe(value TimeField) JoinCondition
}
func Time ¶
func Time(s Selectable, name string) TimeField
type UpdateSetMoreStep ¶
type UpdateSetMoreStep interface {
Executable
UpdateSetStep
Where(conditions ...Condition) Executable
}
type UpdateSetStep ¶
type UpdateSetStep interface {
SetString(StringField, string) UpdateSetMoreStep
SetInt(IntField, int) UpdateSetMoreStep
SetInt64(Int64Field, int64) UpdateSetMoreStep
SetTime(TimeField, time.Time) UpdateSetMoreStep
}
func Update ¶
func Update(t TableLike) UpdateSetStep
Click to show internal directories.
Click to hide internal directories.