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
- func Qualified(parts ...string) string
- type Aliasable
- type BlobField
- type BoolField
- type Condition
- type DateField
- type DatetimeField
- type DeleteWhereStep
- type Dialect
- type Executable
- type Field
- type FieldBinding
- type FieldFunction
- type FieldMeta
- type Float32Field
- type Float64Field
- type Functional
- type InsertResultStep
- type InsertSetMoreStep
- type InsertSetStep
- type Int64Field
- type IntField
- type JoinCondition
- type JoinType
- type NullBlobField
- type NullBoolField
- type NullDateField
- type NullDatetimeField
- type NullFloat32Field
- type NullFloat64Field
- type NullInt64Field
- type NullIntField
- type NullStringField
- type NullTimeField
- type NullableBlob
- type NullableDate
- type NullableDatetime
- type NullableTime
- 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
func GroupConcat ¶
func GroupConcat(field Field) *groupConcat
Types ¶
type BlobField ¶
type BlobField interface { TableField Eq(value []byte) Condition IsEq(value BlobField) JoinCondition Gt(value []byte) Condition IsGt(value BlobField) JoinCondition Ge(value []byte) Condition IsGe(value BlobField) JoinCondition Lt(value []byte) Condition IsLt(value BlobField) JoinCondition Le(value []byte) Condition IsLe(value BlobField) JoinCondition }
func Blob ¶
func Blob(s Selectable, name string) BlobField
type BoolField ¶
type BoolField interface { TableField Eq(value bool) Condition IsEq(value BoolField) JoinCondition Gt(value bool) Condition IsGt(value BoolField) JoinCondition Ge(value bool) Condition IsGe(value BoolField) JoinCondition Lt(value bool) Condition IsLt(value BoolField) JoinCondition Le(value bool) Condition IsLe(value BoolField) JoinCondition }
func Bool ¶
func Bool(s Selectable, name string) BoolField
type Condition ¶
type Condition struct { Binding FieldBinding Predicate PredicateType }
type DateField ¶
type DateField interface { TableField Eq(value time.Time) Condition IsEq(value DateField) JoinCondition Gt(value time.Time) Condition IsGt(value DateField) JoinCondition Ge(value time.Time) Condition IsGe(value DateField) JoinCondition Lt(value time.Time) Condition IsLt(value DateField) JoinCondition Le(value time.Time) Condition IsLe(value DateField) JoinCondition }
func Date ¶
func Date(s Selectable, name string) DateField
type DatetimeField ¶
type DatetimeField interface { TableField Eq(value time.Time) Condition IsEq(value DatetimeField) JoinCondition Gt(value time.Time) Condition IsGt(value DatetimeField) JoinCondition Ge(value time.Time) Condition IsGe(value DatetimeField) JoinCondition Lt(value time.Time) Condition IsLt(value DatetimeField) JoinCondition Le(value time.Time) Condition IsLe(value DatetimeField) JoinCondition }
func Datetime ¶
func Datetime(s Selectable, name string) DatetimeField
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 Type() reflect.Type 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 Float32Field ¶
type Float32Field interface { TableField Eq(value float32) Condition IsEq(value Float32Field) JoinCondition Gt(value float32) Condition IsGt(value Float32Field) JoinCondition Ge(value float32) Condition IsGe(value Float32Field) JoinCondition Lt(value float32) Condition IsLt(value Float32Field) JoinCondition Le(value float32) Condition IsLe(value Float32Field) JoinCondition }
func Float32 ¶
func Float32(s Selectable, name string) Float32Field
type Float64Field ¶
type Float64Field interface { TableField Eq(value float64) Condition IsEq(value Float64Field) JoinCondition Gt(value float64) Condition IsGt(value Float64Field) JoinCondition Ge(value float64) Condition IsGe(value Float64Field) JoinCondition Lt(value float64) Condition IsLt(value Float64Field) JoinCondition Le(value float64) Condition IsLe(value Float64Field) JoinCondition }
func Float64 ¶
func Float64(s Selectable, name string) Float64Field
type Functional ¶
type InsertResultStep ¶
type InsertSetMoreStep ¶
type InsertSetMoreStep interface { Executable InsertSetStep Returning(TableField) InsertResultStep }
type InsertSetStep ¶
type InsertSetStep interface { Set(TableField, interface{}) InsertSetMoreStep SetBool(BoolField, bool) InsertSetMoreStep SetDate(DateField, time.Time) InsertSetMoreStep SetDatetime(DatetimeField, time.Time) InsertSetMoreStep SetFloat32(Float32Field, float32) InsertSetMoreStep SetFloat64(Float64Field, float64) InsertSetMoreStep SetBlob(BlobField, []byte) InsertSetMoreStep SetInt(IntField, int) InsertSetMoreStep SetInt64(Int64Field, int64) InsertSetMoreStep SetNullBool(NullBoolField, sql.NullBool) InsertSetMoreStep SetNullDate(NullDateField, NullableDate) InsertSetMoreStep SetNullDatetime(NullDatetimeField, NullableDatetime) InsertSetMoreStep SetNullFloat32(NullFloat32Field, sql.NullFloat64) InsertSetMoreStep SetNullFloat64(NullFloat64Field, sql.NullFloat64) InsertSetMoreStep SetNullBlob(NullBlobField, NullableBlob) InsertSetMoreStep SetNullInt(NullIntField, sql.NullInt64) InsertSetMoreStep SetNullInt64(NullInt64Field, sql.NullInt64) InsertSetMoreStep SetNullString(NullStringField, sql.NullString) InsertSetMoreStep SetNullTime(NullTimeField, NullableTime) InsertSetMoreStep SetString(StringField, string) 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 NullBlobField ¶
type NullBlobField interface { TableField Eq(value NullableBlob) Condition IsEq(value NullBlobField) JoinCondition Gt(value NullableBlob) Condition IsGt(value NullBlobField) JoinCondition Ge(value NullableBlob) Condition IsGe(value NullBlobField) JoinCondition Lt(value NullableBlob) Condition IsLt(value NullBlobField) JoinCondition Le(value NullableBlob) Condition IsLe(value NullBlobField) JoinCondition }
func NullBlob ¶
func NullBlob(s Selectable, name string) NullBlobField
type NullBoolField ¶
type NullBoolField interface { TableField Eq(value sql.NullBool) Condition IsEq(value NullBoolField) JoinCondition Gt(value sql.NullBool) Condition IsGt(value NullBoolField) JoinCondition Ge(value sql.NullBool) Condition IsGe(value NullBoolField) JoinCondition Lt(value sql.NullBool) Condition IsLt(value NullBoolField) JoinCondition Le(value sql.NullBool) Condition IsLe(value NullBoolField) JoinCondition }
func NullBool ¶
func NullBool(s Selectable, name string) NullBoolField
type NullDateField ¶
type NullDateField interface { TableField Eq(value NullableDate) Condition IsEq(value NullDateField) JoinCondition Gt(value NullableDate) Condition IsGt(value NullDateField) JoinCondition Ge(value NullableDate) Condition IsGe(value NullDateField) JoinCondition Lt(value NullableDate) Condition IsLt(value NullDateField) JoinCondition Le(value NullableDate) Condition IsLe(value NullDateField) JoinCondition }
func NullDate ¶
func NullDate(s Selectable, name string) NullDateField
type NullDatetimeField ¶
type NullDatetimeField interface { TableField Eq(value NullableDatetime) Condition IsEq(value NullDatetimeField) JoinCondition Gt(value NullableDatetime) Condition IsGt(value NullDatetimeField) JoinCondition Ge(value NullableDatetime) Condition IsGe(value NullDatetimeField) JoinCondition Lt(value NullableDatetime) Condition IsLt(value NullDatetimeField) JoinCondition Le(value NullableDatetime) Condition IsLe(value NullDatetimeField) JoinCondition }
func NullDatetime ¶
func NullDatetime(s Selectable, name string) NullDatetimeField
type NullFloat32Field ¶
type NullFloat32Field interface { TableField Eq(value sql.NullFloat64) Condition IsEq(value NullFloat32Field) JoinCondition Gt(value sql.NullFloat64) Condition IsGt(value NullFloat32Field) JoinCondition Ge(value sql.NullFloat64) Condition IsGe(value NullFloat32Field) JoinCondition Lt(value sql.NullFloat64) Condition IsLt(value NullFloat32Field) JoinCondition Le(value sql.NullFloat64) Condition IsLe(value NullFloat32Field) JoinCondition }
func NullFloat32 ¶
func NullFloat32(s Selectable, name string) NullFloat32Field
type NullFloat64Field ¶
type NullFloat64Field interface { TableField Eq(value sql.NullFloat64) Condition IsEq(value NullFloat64Field) JoinCondition Gt(value sql.NullFloat64) Condition IsGt(value NullFloat64Field) JoinCondition Ge(value sql.NullFloat64) Condition IsGe(value NullFloat64Field) JoinCondition Lt(value sql.NullFloat64) Condition IsLt(value NullFloat64Field) JoinCondition Le(value sql.NullFloat64) Condition IsLe(value NullFloat64Field) JoinCondition }
func NullFloat64 ¶
func NullFloat64(s Selectable, name string) NullFloat64Field
type NullInt64Field ¶
type NullInt64Field interface { TableField Eq(value sql.NullInt64) Condition IsEq(value NullInt64Field) JoinCondition Gt(value sql.NullInt64) Condition IsGt(value NullInt64Field) JoinCondition Ge(value sql.NullInt64) Condition IsGe(value NullInt64Field) JoinCondition Lt(value sql.NullInt64) Condition IsLt(value NullInt64Field) JoinCondition Le(value sql.NullInt64) Condition IsLe(value NullInt64Field) JoinCondition }
func NullInt64 ¶
func NullInt64(s Selectable, name string) NullInt64Field
type NullIntField ¶
type NullIntField interface { TableField Eq(value sql.NullInt64) Condition IsEq(value NullIntField) JoinCondition Gt(value sql.NullInt64) Condition IsGt(value NullIntField) JoinCondition Ge(value sql.NullInt64) Condition IsGe(value NullIntField) JoinCondition Lt(value sql.NullInt64) Condition IsLt(value NullIntField) JoinCondition Le(value sql.NullInt64) Condition IsLe(value NullIntField) JoinCondition }
func NullInt ¶
func NullInt(s Selectable, name string) NullIntField
type NullStringField ¶
type NullStringField interface { TableField Eq(value sql.NullString) Condition IsEq(value NullStringField) JoinCondition Gt(value sql.NullString) Condition IsGt(value NullStringField) JoinCondition Ge(value sql.NullString) Condition IsGe(value NullStringField) JoinCondition Lt(value sql.NullString) Condition IsLt(value NullStringField) JoinCondition Le(value sql.NullString) Condition IsLe(value NullStringField) JoinCondition }
func NullString ¶
func NullString(s Selectable, name string) NullStringField
type NullTimeField ¶
type NullTimeField interface { TableField Eq(value NullableTime) Condition IsEq(value NullTimeField) JoinCondition Gt(value NullableTime) Condition IsGt(value NullTimeField) JoinCondition Ge(value NullableTime) Condition IsGe(value NullTimeField) JoinCondition Lt(value NullableTime) Condition IsLt(value NullTimeField) JoinCondition Le(value NullableTime) Condition IsLe(value NullTimeField) JoinCondition }
func NullTime ¶
func NullTime(s Selectable, name string) NullTimeField
type NullableBlob ¶
func (*NullableBlob) Scan ¶
func (self *NullableBlob) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullableDate ¶
func (*NullableDate) Scan ¶
func (self *NullableDate) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullableDatetime ¶
type NullableDatetime struct { Datetime time.Time Valid bool // Valid is true if Datetime is not NULL }
func (*NullableDatetime) Scan ¶
func (self *NullableDatetime) Scan(value interface{}) error
Scan implements the Scanner interface.
type NullableTime ¶
func (*NullableTime) Scan ¶
func (self *NullableTime) Scan(value interface{}) error
Scan implements the Scanner interface.
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 { BoolField(name string) BoolField DateField(name string) DateField DatetimeField(name string) DatetimeField Float32Field(name string) Float32Field Float64Field(name string) Float64Field BlobField(name string) BlobField IntField(name string) IntField Int64Field(name string) Int64Field NullBoolField(name string) NullBoolField NullDateField(name string) NullDateField NullDatetimeField(name string) NullDatetimeField NullFloat32Field(name string) NullFloat32Field NullFloat64Field(name string) NullFloat64Field NullBlobField(name string) NullBlobField NullIntField(name string) NullIntField NullInt64Field(name string) NullInt64Field NullStringField(name string) NullStringField NullTimeField(name string) NullTimeField StringField(name string) StringField 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 { Set(TableField, interface{}) UpdateSetMoreStep SetBool(BoolField, bool) UpdateSetMoreStep SetDate(DateField, time.Time) UpdateSetMoreStep SetDatetime(DatetimeField, time.Time) UpdateSetMoreStep SetFloat32(Float32Field, float32) UpdateSetMoreStep SetFloat64(Float64Field, float64) UpdateSetMoreStep SetBlob(BlobField, []byte) UpdateSetMoreStep SetInt(IntField, int) UpdateSetMoreStep SetInt64(Int64Field, int64) UpdateSetMoreStep SetNullBool(NullBoolField, sql.NullBool) UpdateSetMoreStep SetNullDate(NullDateField, NullableDate) UpdateSetMoreStep SetNullDatetime(NullDatetimeField, NullableDatetime) UpdateSetMoreStep SetNullFloat32(NullFloat32Field, sql.NullFloat64) UpdateSetMoreStep SetNullFloat64(NullFloat64Field, sql.NullFloat64) UpdateSetMoreStep SetNullBlob(NullBlobField, NullableBlob) UpdateSetMoreStep SetNullInt(NullIntField, sql.NullInt64) UpdateSetMoreStep SetNullInt64(NullInt64Field, sql.NullInt64) UpdateSetMoreStep SetNullString(NullStringField, sql.NullString) UpdateSetMoreStep SetNullTime(NullTimeField, NullableTime) UpdateSetMoreStep SetString(StringField, string) UpdateSetMoreStep SetTime(TimeField, time.Time) UpdateSetMoreStep }
func Update ¶
func Update(t TableLike) UpdateSetStep