Documentation
¶
Index ¶
- Constants
- Variables
- func AsBool(v string) (bool, error)
- func AsByte(v string) (byte, error)
- func AsFloat(v string) (float64, error)
- func AsInt(v string) (int64, error)
- func AsLocation(v string) (*time.Location, error)
- func AsMilliseconds(duration int64) float64
- func AsRune(v string) (rune, error)
- func AsSeconds(duration int64) float64
- func AsString(v interface{}) (string, error)
- func NewUuid() string
- func Ptr[T any](v T) *T
- func PtrToAny[T any](v *T) any
- func PtrToValue[T any](v *T) T
- func SplitByString(chars string) func(data []byte, atEOF bool) (advance int, token []byte, err error)
- func SplitByStringWithPrefix(chars string, prefixs []string) func(data []byte, atEOF bool) (advance int, token []byte, err error)
- func SplitForXmlAttr(data []byte, atEOF bool) (advance int, token []byte, err error)
- func WithLogger(logger Logger) func(*DB)
- func WithMapper(mapper *Mapper) func(*DB)
- type Args
- type BatisInput
- type BindHandler
- type BindVar
- type Choose
- type DB
- func (b *DB) Args(variables interface{}) *DB
- func (b *DB) Bind(variables interface{}) *DB
- func (b *DB) Clone() *DB
- func (b *DB) DeleteMapper(mapperId string) *DB
- func (b *DB) Execute() *DB
- func (b *DB) Find(dest any) *DB
- func (b *DB) InsertMapper(mapperId string) *DB
- func (b *DB) Mapper(mapperId string) *DB
- func (b *DB) RawExec(query string, args ...any) *DB
- func (b *DB) RawQuery(query string, args ...any) *DB
- func (b *DB) SelectMapper(mapperId string) *DB
- func (b *DB) Transaction(fn func(tx *DB) error) (err error)
- func (b *DB) UpdateMapper(mapperId string) *DB
- func (b *DB) WithContext(ctx context.Context) *DB
- type DateTime
- func (dt DateTime) AddDay(d int) DateTime
- func (dt DateTime) AddDuration(duration time.Duration) DateTime
- func (dt DateTime) AddDurationInText(duration string) (DateTime, error)
- func (dt DateTime) AddHour(h int) DateTime
- func (dt DateTime) AddMinute(m int) DateTime
- func (dt DateTime) AddMonth(m int) DateTime
- func (dt DateTime) AddSecond(s int) DateTime
- func (dt DateTime) AddWeek(week int) DateTime
- func (dt DateTime) AddYear(y int) DateTime
- func (dt DateTime) After(t DateTime) bool
- func (dt DateTime) AfterInTime(t time.Time) bool
- func (dt DateTime) Before(t DateTime) bool
- func (dt DateTime) BeforeInTime(t time.Time) bool
- func (dt DateTime) BeforeOrEqual(t DateTime) bool
- func (dt DateTime) Day() int
- func (dt DateTime) EndOfDay() DateTime
- func (dt DateTime) EndOfMonth() DateTime
- func (dt DateTime) EndOfWeek() DateTime
- func (dt DateTime) Equal(t DateTime) bool
- func (dt DateTime) EqualInTime(t time.Time) bool
- func (dt DateTime) Format(format TimeFormat) string
- func (dt DateTime) Hour() int
- func (dt DateTime) IsZero() bool
- func (dt DateTime) Minute() int
- func (dt DateTime) Month() time.Month
- func (dt DateTime) Nanosecond() int
- func (dt DateTime) Second() int
- func (dt DateTime) StartOfDay() DateTime
- func (dt DateTime) StartOfMonth() DateTime
- func (dt DateTime) StartOfWeek() DateTime
- func (dt DateTime) ToTime() time.Time
- func (dt DateTime) Unix() int64
- func (dt DateTime) UnixNano() int64
- func (dt DateTime) Year() int
- type Delete
- type Elif
- type Else
- type Foreach
- type Gobatis
- type Handler
- type HandlerPayload
- type If
- type Include
- type Insert
- type Logger
- type Mapper
- type Otherwise
- type PgArrayBool
- type PgArrayBox
- type PgArrayCircle
- type PgArrayFloat
- type PgArrayInt
- type PgArrayLSeg
- type PgArrayLine
- type PgArrayPath
- type PgArrayPoint
- type PgArrayPolygon
- type PgArrayRange
- type PgArrayRecord
- type PgArrayString
- type PgBox
- type PgCircle
- type PgLSeg
- type PgLine
- type PgPath
- type PgPoint
- type PgPolygon
- type PgRange
- type PgRecord
- type PgVectorFloat
- type Select
- type Sql
- type TimeFormat
- func (tf TimeFormat) AsTime(v string) (DateTime, error)
- func (tf TimeFormat) AsTimeFormat() TimeFormat
- func (tf TimeFormat) AsTimeInLocation(v string, loc *time.Location) (DateTime, error)
- func (tf TimeFormat) AsTimeInLocationName(v string, locationName string) (DateTime, error)
- func (tf TimeFormat) String() string
- type Trim
- type Update
- type When
- type Where
- type XmlName
Constants ¶
const ( LogLevelDebug = iota LogLevelInfo LogLevelError )
const ( TestKey = `test` PrefixOverridesKey = `prefixOverrides` PrefixKey = `prefix` CollectionKey = `collection` ItemKey = `item` SeparatorKey = `separator` IdKey = `id` TypeKey = `type` IndexKey = `index` )
const ( // TsTzDateTimeFormat postgres timestamp with time zone format TsTzDateTimeFormat = `2006-01-02 15:04:05-07` // TsDateTimeFormat postgres timestamp format TsDateTimeFormat = `2006-01-02 15:04:05` )
Variables ¶
var ( ErrorNotFound = errors.New(`gobatis: record not found`) ErrorInvalidScanRowType = errors.New(`scanRow: non-pointer of dest`) ErrorInvalidScanSliceType = errors.New(`scanSlice: non-pointer of dest`) ErrorNowRowsFound = errors.New(`no rows found`) ErrorMapperCallFirst = errors.New(`gobatis: Mapper() must be invoked, before Bind`) ErrorExecuteFailedWithType = errors.New(`gobatis: Execute: invalid type`) ErrorDestCantBeNil = errors.New("gobatis: dest can't be nil") ErrorBindArgsNeedBeMapOrStruct = errors.New(`gobatis: Args need be map or struct`) ErrorPreparedStatementsEmpty = errors.New(`gobatis: prepared statements empty`) )
var ( ErrorElementNotSupported = errors.New(`element not supported`) ErrorXmlNotValid = errors.New(`xml not valid`) ErrorElifMustFollowIfStmt = errors.New(`elif must follow if statement`) ErrorElseMustFollowIfStmt = errors.New(`else must follow if statement`) ErrorOtherwiseMustFollowChooseStmt = errors.New(`otherwise must follow when statement`) ErrorForeachNeedCollection = errors.New(`foreach statment need collection attr`) ErrorForeachNeedItem = errors.New(`foreach statment need item attr`) ErrorInputMustBeMap = errors.New(`input must be map`) ErrorForeachStatementIsNotArrayOrMap = errors.New(`foreach statement is not array or map`) ErrorIncludeTagNeedRefIdAttr = errors.New(`include tag need refid attr`) )
var ( ArrayStringReplacer = strings.NewReplacer(`\"`, `"`, `\\`, `\`) ArrayStringReverseReplacer = strings.NewReplacer(`"`, `\"`) )
var ( // SplitPgArrayType split string used by bufio.Scanner Split func SplitPgArrayType = SplitByString("{,}") // SplitPgArrayStringType split string used by bufio.Scanner Split func SplitPgArrayStringType = SplitByString("{,\"}") // SplitPgRangeType split string used by bufio.Scanner Split func SplitPgRangeType = SplitByString("[,]()") // SplitPgRecordType split string used by bufio.Scanner Split func SplitPgRecordType = SplitByString(`(,")`) // SplitPgArrayRecordType split string used by bufio.Scanner Split func SplitPgArrayRecordType = SplitByString("{}(,\")") // SplitPgPointType split string used by bufio.Scanner Split func SplitPgPointType = SplitByString(`(,)`) // SplitPgArrayLineType split string used by bufio.Scanner Split func SplitPgArrayLineType = SplitByString(`{",}`) // SplitPgArrayLsegType split string used by bufio.Scanner Split func SplitPgArrayLsegType = SplitByString(`{[(,)]}`) // SplitPgArrayBoxType split string used by bufio.Scanner Split func SplitPgArrayBoxType = SplitByString(`{(),;}`) // SplitPgArrayPathType split string used by bufio.Scanner Split func SplitPgArrayPathType = SplitByString(`{"(),}`) // SplitPgCircleType split string used by bufio.Scanner Split func SplitPgCircleType = SplitByString(`<(,)>`) // SplitPgArrayCircleType split string used by bufio.Scanner Split func SplitPgArrayCircleType = SplitByString(`{"<(,)>}`) // SplitPgArrayRangeType split string used by bufio.Scanner Split func SplitPgArrayRangeType = SplitByString(`{"[(,)]}`) // SplitMoreCharsPrefix every prefix in the SplitMoreCharsPrefix will be split togother. SplitMoreCharsPrefix = []string{`\"`} )
var ( PgNewRecordReplacer = strings.NewReplacer(`\\`, `\`) PgNewArrayRecordReplacer = strings.NewReplacer(`\\\\`, `\`, `\\\\\\\\`, `\`) PgNewRecordInnerReplacer = strings.NewReplacer(`""`, `"`, `\\\\`, `\`, `\\`, ``) PgNewArrayRecordInnerReplacer = strings.NewReplacer(`\\\\\"\"`, `"`, `\\\\`, `\`, `\\`, ``) DoubleQuoteReplacer = strings.NewReplacer(`""`, `"`) SlashDoubleQuoteReplacer = strings.NewReplacer(`\"\"`, `"`, `\\`, `\`) RecordReverseReplacer = strings.NewReplacer(`"`, `""`, `\`, `\\`) ArrayRecordReverseReplacer = strings.NewReplacer(`"`, `\\\\\"\"`, `\`, `\\\\`) )
ROW(2, '"\test', array['"\12345678901', '12345678902\\"']) (2,"""\\test","{""\\""\\\\12345678901"",""12345678902\\\\\\\\\\""""}", "[aaaa,bbb)")
Functions ¶
func AsInt ¶
AsInt type convert tools function contains: int64, byte, rune, float64, bool, string time.Time simple example:
Parse string into int64 v, _ := AsInt("10")
func AsLocation ¶
AsLocation convert string to *time.Location
func AsMilliseconds ¶
AsMilliseconds convert duration to milliseconds
func SplitByString ¶
func SplitByString(chars string) func(data []byte, atEOF bool) (advance int, token []byte, err error)
SplitByString split string used by bufio.Scanner Split func any char in chars will be split and return
func SplitByStringWithPrefix ¶
func SplitByStringWithPrefix(chars string, prefixs []string) func(data []byte, atEOF bool) (advance int, token []byte, err error)
SplitByStringWithPrefix split string used by bufio.Scanner Split func any char in chars will be split and return
func SplitForXmlAttr ¶
Types ¶
type BindHandler ¶
type BindHandler interface {
Bind(ctx context.Context, input *HandlerPayload) *BindVar
}
type Choose ¶
type Choose struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
}
func (*Choose) UnmarshalXML ¶
type DB ¶
type DB struct {
// error information.
LastInserId int64
RowsAffected int64
Error error
// contains filtered or unexported fields
}
func OpenWithEmbedFs ¶
func OpenWithEmbedFs( driverName, dataSourceName string, fs embed.FS, directory string, opts ...func(*DB), ) (*DB, error)
OpenWithEmbedFs open database with embed.FS
func (*DB) Bind ¶
Bind variables to mapper generate stmt prepared handler next call will use the stmt. caller should have known if the variables input was map, he must make sure the input variables [ thread-safe ].
func (*DB) DeleteMapper ¶
DeleteMapper Find mapper from delete mapper list, if not found, return error
func (*DB) Execute ¶
Execute database's insert, update and delete if database running statements with returning, use method Find instead.
func (*DB) InsertMapper ¶
InsertMapper Find mapper from insert mapper list, if not found, return error
func (*DB) Mapper ¶
Mapper fetch mapper from all xml with the id identifier
forexample:
fetch data: db.Mapper('id').Args(variables).Find(dest).Error
otherwise: db.Mapper('id').Args(variables).Execute().Error
normal state, you can call Mapper(`xxx`) to fetch the mapper
but in some conditions, this is slower, because the find order follow the order of `select`, `insert`, `update`, `delete`
the update & delete mapper list is the last one to fetch, so if your mapper type you known, you can call
SelectMapper(`xxx`), InsertMapper(`xxx`), UpdateMapper(`xxx`), DeleteMapper(`xxx`) directly ¶
to speed up or accelerate the operation.
func (*DB) SelectMapper ¶
SelectMapper Find mapper from select mapper list, if not found, return error
func (*DB) Transaction ¶
Transaction start transaction to database when transaction completed successfully, the tx will be committed and can't use again
func (*DB) UpdateMapper ¶
UpdateMapper Find mapper from update mapper list, if not found, return error
type DateTime ¶
DateTime type convert tools function contains: int64, byte, rune, float64, bool, string time.Time simple example:
Parse string into Time
- tq, _ := AsDateTime("2021-01-01", TimeFormat(`Y-m-d`).AsTimeFormat().String()) println(tq.Format(TimeFormatYmdInCN))
or you can use AsTime() function
dt, _ := TimeFormat(`Y-m-d`).AsTimeFormat().AsTime("2021-01-01")
println(dt.Format(TimeFormatYmdInCN)
also, you can simplely use like this:
dt, _ := TimeFormatYmd.AsTime("2021-01-01")
println(dt.Format(TimeFormatYmdInCN)
func AsDateTime ¶
AsDateTime type convert tools function contains: int64, byte, rune, float64, bool, string time.Time simple example:
Parse string into Time
- tq, _ := AsDateTime("2021-01-01", TimeFormat(`Y-m-d`).AsTimeFormat().String()) println(tq.Format(TimeFormatYmdInCN))
or you can use AsTime() function
dt, _ := TimeFormat(`Y-m-d`).AsTimeFormat().AsTime("2021-01-01")
println(dt.Format(TimeFormatYmdInCN)
also, you can simplely use like this:
dt, _ := TimeFormatYmd.AsTime("2021-01-01")
println(dt.Format(TimeFormatYmdInCN)
AsDateTime convert string to DateTime
func NewDateTimeFromNow ¶
func NewDateTimeFromNow() DateTime
NewDateTimeFromNow create DateTime from now
func NewDateTimeFromTime ¶
NewDateTimeFromTime create DateTime from time.Time
func (DateTime) AddDuration ¶
AddDuration add duration
func (DateTime) AddDurationInText ¶
AddDurationInText add duration in text
func (DateTime) AfterInTime ¶
AfterInTime return true if the DateTime is after another time.Time
func (DateTime) BeforeInTime ¶
BeforeInTime return true if the DateTime is before another time.Time
func (DateTime) BeforeOrEqual ¶
BeforeOrEqual compare DateTime with another DateTime
func (DateTime) EndOfDay ¶
EndOfDay return end of day some database engine like mysql, the precison of datetime is microseconds, so we omit the nsec part. if you want to set the nsec, you can use DateTime.AddDurationInText() or DateTime.AddDuration() to set the nsec.
func (DateTime) EndOfMonth ¶
EndOfMonth return end of month
func (DateTime) EqualInTime ¶
EqualInTime compare DateTime with time.Time is Equal
func (DateTime) Format ¶
func (dt DateTime) Format(format TimeFormat) string
Format time with the given format string and return the formatted string
func (DateTime) StartOfDay ¶
StartOfDay return start of day
func (DateTime) StartOfMonth ¶
StartOfMonth return start of month
func (DateTime) StartOfWeek ¶
StartOfWeek return start of week (Monday)
type Delete ¶
type Delete struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
Text string `xml:",chardata"`
}
Delete children can be one of: CharData, If, Elif, Else, Choose, Where, Foreach, Trim, Otherwise, Include, Sql,
func (*Delete) UnmarshalXML ¶
type Elif ¶
func (*Elif) UnmarshalXML ¶
type Else ¶
func (*Else) UnmarshalXML ¶
type Foreach ¶
type Foreach struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
}
func NewForeach ¶
func NewForeach() *Foreach
func (*Foreach) UnmarshalXML ¶
type Handler ¶
type Handler interface {
Evaluate(ctx context.Context, input *HandlerPayload) (string, error)
}
type HandlerPayload ¶
type Include ¶
type Include struct {
RefId string `xml:"refid,attr"`
Alias string `xml:"alias,attr"`
Value string `xml:"value,attr"`
}
func NewInclude ¶
func NewInclude() *Include
type Insert ¶
type Insert struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
Text string `xml:",chardata"`
}
Insert children can be one of: CharData, If, Elif, Else, Choose, Where, Foreach, Trim, Otherwise, Include, Sql,
func (*Insert) UnmarshalXML ¶
type Mapper ¶
type Mapper struct {
Select []*Select
Update []*Update
Insert []*Insert
Delete []*Delete
Sql []*Sql
Attrs []xml.Attr
AttrMap map[string]string
}
Mapper all data mapper into Mapper struct
func ParseMapperFromBuffer ¶
ParseMapperFromBuffer parse xml mapper from buffer
func (*Mapper) UnmarshalXML ¶
type Otherwise ¶
type Otherwise struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
}
func NewOtherwise ¶
func NewOtherwise() *Otherwise
func (*Otherwise) UnmarshalXML ¶
type PgArrayBool ¶
type PgArrayBool []bool
PgArrayBool postgresql array bool Exists []bool which Exists was PgArrayBool type
func (*PgArrayBool) Scan ¶
func (pg *PgArrayBool) Scan(value any) error
Scan sql/database Scan interface
type PgArrayBox ¶
type PgArrayBox []*PgBox
PgArrayBox postgres array box type
func (*PgArrayBox) Scan ¶
func (pg *PgArrayBox) Scan(value any) error
Scan sql/database Scan interface
type PgArrayCircle ¶
type PgArrayCircle []*PgCircle
PgArrayCircle postgres circle[] type
func (*PgArrayCircle) Scan ¶
func (pg *PgArrayCircle) Scan(value any) error
Scan sql/database Scan interface
type PgArrayFloat ¶
type PgArrayFloat []float64
PgArrayFloat postgresql array float Prices []float64 which Prices was PgArrayFloat type
func (*PgArrayFloat) Scan ¶
func (pg *PgArrayFloat) Scan(value any) error
Scan sql/database Scan interface
type PgArrayInt ¶
type PgArrayInt []int64
PgArrayInt postgresql array int Ids []int which Ids was PgArrayInt type
func (*PgArrayInt) Scan ¶
func (pg *PgArrayInt) Scan(value any) error
Scan sql/database Scan interface
type PgArrayLSeg ¶
type PgArrayLSeg []*PgLSeg
PgArrayLSeg postgres array lseg type
func (*PgArrayLSeg) Scan ¶
func (pg *PgArrayLSeg) Scan(value any) error
Scan sql/database Scan interface
type PgArrayLine ¶
type PgArrayLine []*PgLine
PgArrayLine postgres array line type
func (*PgArrayLine) Scan ¶
func (pg *PgArrayLine) Scan(value any) error
Scan sql/database Scan interface
type PgArrayPath ¶
type PgArrayPath []*PgPath
PgArrayPath postgres path[] type
func (*PgArrayPath) Scan ¶
func (pg *PgArrayPath) Scan(value any) error
Scan sql/database Scan interface
type PgArrayPoint ¶
type PgArrayPoint []*PgPoint
PgArrayPoint postgres point[] type
func (*PgArrayPoint) Scan ¶
func (pg *PgArrayPoint) Scan(value any) error
Scan sql/database Scan interface
type PgArrayPolygon ¶
type PgArrayPolygon []*PgPolygon
PgArrayPolygon postgres polygon[] type
func (*PgArrayPolygon) Scan ¶
func (pg *PgArrayPolygon) Scan(value any) error
Scan sql/database Scan interface
type PgArrayRange ¶
type PgArrayRange []*PgRange
PgArrayRange postgres range[], contains `int4range`, `int8range`, `numrange`, `tsrange`, `tstzrange`, `daterange` type
func (*PgArrayRange) Scan ¶
func (pg *PgArrayRange) Scan(value any) error
Scan sql/database Scan interface
type PgArrayRecord ¶
type PgArrayRecord []PgRecord
func (*PgArrayRecord) Scan ¶
func (pg *PgArrayRecord) Scan(value any) error
Scan sql/database Scan interface
type PgArrayString ¶
type PgArrayString []string
PgArrayString postgresql array string Names []text which Names was PgArrayString type
func (*PgArrayString) Scan ¶
func (pg *PgArrayString) Scan(value any) error
Scan sql/database Scan interface
type PgPolygon ¶
type PgPolygon []*PgPoint
PgPolygon postgres polygon type
type PgRange ¶
PgRange postgres range type support int4range, int8range, numrange, tsrange, tstzrange, daterange
type PgRecord ¶
type PgRecord []string
PgRecord postgres record type caller should use this method as inner value to parse value into field. each field should be string, array, record, range type. user should convert to the real type.
caller should use this method as inner value to parse value into field. like this:
type SomeRecord struct {
value gobatis.Record
FieldOne string `pg:"field_one"`
FieldTwo string `pg:"field_two"`
}
func (sr *SomeRecord) Scan(value any) error {
err := sr.value.scan(value)
if err != nil {
return err
}
sr.FieldOne = sr.value[0]
sr.FieldTwo = sr.value[1]
return nil
}
func (sr *SomeRecord) Value() (driver.Value, error) {
sr.value = nil
sr.value = append(sr.value, sr.FieldOne, sr.FieldTwo)
return sr.value.Value()
}
type PgVectorFloat ¶ added in v1.3.9
type PgVectorFloat []float64
PgVectorFloat postgresql array float Prices []float64 which Prices was PgArrayFloat type
func (*PgVectorFloat) Scan ¶ added in v1.3.9
func (pg *PgVectorFloat) Scan(value any) error
Scan sql/database Scan interface
type Select ¶
type Select struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
}
Select children can be one of: CharData, If, Elif, Else, Choose, Where, Foreach, Trim, Otherwise, Include, Sql,
func (*Select) UnmarshalXML ¶
type TimeFormat ¶
type TimeFormat string
TimeFormat type convert tools function simple example:
Parse string into Time ¶
- tq, _ := AsDateTime("2021-01-01", TimeFormat(`Y-m-d`).AsTimeFormat().String()) println(tq.Format(TimeFormatYmdInCN))
or you can use AsTime() function
dt, _ := TimeFormat(`Y-m-d`).AsTimeFormat().AsTime("2021-01-01")
println(dt.Format(TimeFormatYmdInCN)
also, you can simplely use like this:
dt, _ := TimeFormatYmd.AsTime("2021-01-01")
println(dt.Format(TimeFormatYmdInCN)
const ( TimeFormatY TimeFormat = "2006" TimeFormatYInCN TimeFormat = "2006年" TimeFormatYm TimeFormat = "2006-1" TimeFormatMy TimeFormat = "1-2006" TimeFormatYmInCN TimeFormat = "2006年1月" TimeFormatMyInCN TimeFormat = "1月2006年" TimeFormatYmWithSlash TimeFormat = "2006/1" TimeFormatMyWithSlash TimeFormat = "1/2006" TimeFormatYmd TimeFormat = "2006-1-2" TimeFormatYmdWithSlash TimeFormat = "2006/1/2" TimeFormatYmdInCN TimeFormat = "2006年1月2日" TimeFormatYmdHms TimeFormat = "2006-1-2 15:04:05" TimeFormatYmdHmsWithSlash TimeFormat = "2006/1/2 15:04:05" TimeFormatYmdHmsInCN TimeFormat = "2006年1月2日 15点04分05" TimeFormatYmdHmsWithSecondInCN TimeFormat = "2006年1月2日 15点04分05秒" TimeFormatHms TimeFormat = "15:04:05" TimeFormatHmsInCN TimeFormat = "15点04分05" TimeFormatHmsWithSecondInCN TimeFormat = "15点04分05秒" TimeFormatDmyHms TimeFormat = "2/1/2006 15:04:05" TimeFormatDmyHis TimeFormat = TimeFormatDmyHms TimeFormatMdy TimeFormat = "1-2-2006" TimeFormatYmdHis TimeFormat = TimeFormatYmdHms TimeFormatYmdHisWithSlash TimeFormat = TimeFormatYmdHmsWithSlash TimeFormatYmdHisInCN TimeFormat = TimeFormatYmdHmsInCN TimeFormatHis TimeFormat = TimeFormatHms TimeFormatHisInCN TimeFormat = TimeFormatHmsInCN TimeFormatYmdHisWithSecondInCN TimeFormat = TimeFormatYmdHmsWithSecondInCN TimeFormatHisWithSecondInCN TimeFormat = TimeFormatHmsWithSecondInCN TimeFormatRFC3339 TimeFormat = time.RFC3339 TimeFormatRFC3339Nano TimeFormat = time.RFC3339Nano TimeFormatRFC822 TimeFormat = time.RFC822 TimeFormatRFC850 TimeFormat = time.RFC850 TimeFormatRFC822Z TimeFormat = time.RFC822Z TimeFormatRFC1123 TimeFormat = time.RFC1123 TimeFormatRFC1123Z TimeFormat = time.RFC1123Z TimeFormatUnixDate TimeFormat = time.UnixDate TimeFormatANSIC TimeFormat = time.ANSIC TimeFormatRubyDate TimeFormat = time.RubyDate TimeFormatDateTimeLayout TimeFormat = time.Layout TimeFormatKitchen TimeFormat = time.Kitchen TimeFormatStamp TimeFormat = time.Stamp TimeFormatStampMilli TimeFormat = time.StampMilli TimeFormatStampMicro TimeFormat = time.StampMicro TimeFormatStampNano TimeFormat = time.StampNano )
func (TimeFormat) AsTime ¶
func (tf TimeFormat) AsTime(v string) (DateTime, error)
AsTime convert string to time.Time
func (TimeFormat) AsTimeFormat ¶
func (tf TimeFormat) AsTimeFormat() TimeFormat
AsTimeFormat convert TimeFormat to time.Time format
func (TimeFormat) AsTimeInLocation ¶
AsTimeInLocation convert string to time.Time
func (TimeFormat) AsTimeInLocationName ¶
func (tf TimeFormat) AsTimeInLocationName(v string, locationName string) (DateTime, error)
AsTimeInLocationName convert string to time.Time
type Trim ¶
func (*Trim) UnmarshalXML ¶
type Update ¶
type Update struct {
Children []interface{}
Attrs []xml.Attr
AttrsMap map[string]string
Sql []*Sql
Text string `xml:",chardata"`
}
Update children can be one of: CharData, If, Elif, Else, Choose, Where, Foreach, Trim, Otherwise, Include, Sql,
func (*Update) UnmarshalXML ¶
type When ¶
func (*When) UnmarshalXML ¶
type Where ¶
func (*Where) UnmarshalXML ¶
Source Files
¶
- choose.go
- delete.go
- elif.go
- else.go
- engine.go
- foreach.go
- if.go
- include.go
- insert.go
- mapper.go
- otherwise.go
- pg_type_array.go
- pg_type_box.go
- pg_type_circle.go
- pg_type_line.go
- pg_type_lseg.go
- pg_type_parse.go
- pg_type_path.go
- pg_type_point.go
- pg_type_polygon.go
- pg_type_range.go
- pg_type_record.go
- preprocess.go
- select.go
- sql.go
- trim.go
- type_convert.go
- update.go
- when.go
- where.go