Documentation
¶
Index ¶
- Constants
- Variables
- func BytesToString(b []byte) string
- func CamelString(s string) string
- func IsSliceContainsStr(sl []string, str string) bool
- func ObjectName(obj interface{}) string
- func SetTimeZone()
- func SnakeString(s string) string
- func StringToBytes(s string) []byte
- func ToStr(value interface{}, args ...int) (s string)
- type CacheMapper
- type Conversion
- type Database
- func (d *Database) Insert(bean interface{}) error
- func (d *Database) Query(str string, bean ...interface{}) (s *Search, err error)
- func (d *Database) QueryRaw(str string, bean ...interface{}) (s *Search, err error)
- func (d *Database) SetBatchPointConf(batchPointConf ic.BatchPointsConfig) *Database
- func (d *Database) SetBpsFunc(bpsFunc bpsActionFunc) *Database
- func (d *Database) SetName(name string) *Database
- type Engine
- func (e *Engine) Acquire() (cl *OClient, err error)
- func (e *Engine) DB(name string) *Database
- func (e *Engine) NewDB(name string) (dbInstance *Database, err error)
- func (e *Engine) NewSession() (session *Session, err error)
- func (e *Engine) Session() *Session
- func (e *Engine) SyncDB(beans ...RetentionPolicy) (err error)
- type GonicMapper
- type IMapper
- type InterfaceTable
- type InterfaceTime
- type JSONTime
- func (p JSONTime) Addr() *JSONTime
- func (p *JSONTime) Convert2Time() time.Time
- func (p *JSONTime) FromDB(data []byte) error
- func (p *JSONTime) GobDecode(data []byte) error
- func (p JSONTime) GobEncode() ([]byte, error)
- func (p JSONTime) MarshalJSON() ([]byte, error)
- func (p *JSONTime) Scan(v interface{}) error
- func (p *JSONTime) SetByTime(timeVal time.Time)
- func (p JSONTime) String() string
- func (p *JSONTime) Time() time.Time
- func (p *JSONTime) ToDB() (b []byte, err error)
- func (p *JSONTime) UnmarshalJSON(data []byte) error
- func (p JSONTime) Value() (driver.Value, error)
- type Map
- type MapString
- type OClient
- type OPool
- type Options
- type PrefixMapper
- type RetentionPolicy
- type SameMapper
- type Search
- type Session
- type SnakeMapper
- type StringVal
- type StructBean
- type SuffixMapper
Constants ¶
const ( TAG = "tag" Field = "field" FieldName = "name" TAGTime = "time" FieldJSON = "json" )
Keywords
const ( //TimeZone ... TimeZone = "Asia/Shanghai" //Custom ... Custom = "2006-01-02 15:04:05" )
const TAGKey = "influx"
TAGKey ...
const Version = "v0.0.1"
Version ...
Variables ¶
var ( //ErrMaxOpen ... ErrMaxOpen = errors.New("连接数超出最大限制") ErrTimeout = errors.New("从池中获取连接超时") )
var ( DefOpts = Options{ HttpConf: ic.HTTPConfig{ Addr: "http://127.0.0.1:8086", Username: "", Password: "", UserAgent: "", Timeout: time.Second * 3, InsecureSkipVerify: false, TLSConfig: nil, Proxy: nil, }, MinOpen: 2, MaxOpen: 100, } )
var ( //ErrEmpty ... ErrEmpty = errors.New("empty") )
var LintGonicMapper = GonicMapper{ "API": true, "ASCII": true, "CPU": true, "CSS": true, "DNS": true, "EOF": true, "GUID": true, "HTML": true, "HTTP": true, "HTTPS": true, "ID": true, "IP": true, "JSON": true, "LHS": true, "QPS": true, "RAM": true, "RHS": true, "RPC": true, "SLA": true, "SMTP": true, "SSH": true, "TLS": true, "TTL": true, "UI": true, "UID": true, "UUID": true, "URI": true, "URL": true, "UTF8": true, "VM": true, "XML": true, "XSRF": true, "XSS": true, }
LintGonicMapper that contains a list of common initialisms taken from golang/lint
Functions ¶
func BytesToString ¶
BytesToString convert []byte type to string type.
func CamelString ¶
CamelString converts the accepted string to a camel string (xx_yy to XxYy)
func IsSliceContainsStr ¶
IsSliceContainsStr returns true if the string exists in given slice, ignore case.
func ObjectName ¶
func ObjectName(obj interface{}) string
ObjectName gets the type name of the object
func SnakeString ¶
SnakeString converts the accepted string to a snake string (XxYy to xx_yy)
func StringToBytes ¶
StringToBytes convert string type to []byte type. NOTE: panic if modify the member value of the []byte.
Types ¶
type CacheMapper ¶
type CacheMapper struct {
// contains filtered or unexported fields
}
CacheMapper ...
type Conversion ¶
Conversion ...
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database ...
func (*Database) SetBatchPointConf ¶
func (d *Database) SetBatchPointConf(batchPointConf ic.BatchPointsConfig) *Database
SetBatchPointConf ...
func (*Database) SetBpsFunc ¶
SetBpsFunc ...
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine ...
func (*Engine) NewSession ¶
NewSession ...
type GonicMapper ¶
GonicMapper implements IMapper. It will consider initialisms when mapping names. E.g. id -> ID, user -> User and to table names: UserID -> user_id, MyUID -> my_uid
func (GonicMapper) Obj2Table ¶
func (mapper GonicMapper) Obj2Table(name string) string
Obj2Table ...
func (GonicMapper) Table2Obj ¶
func (mapper GonicMapper) Table2Obj(name string) string
Table2Obj ...
type JSONTime ¶
JSONTime ...
func Must2JSONTimeAddr ¶ added in v0.0.5
Must2JSONTimeAddr maybe panic
func (*JSONTime) UnmarshalJSON ¶
UnmarshalJSON ...
type Options ¶
type Options struct { HttpConf ic.HTTPConfig //从池中取资源的超时时间 GetTimeout time.Duration MinOpen int MaxOpen int }
Options ...
type PrefixMapper ¶
PrefixMapper provide prefix table name support
func NewPrefixMapper ¶
func NewPrefixMapper(mapper IMapper, prefix string) PrefixMapper
NewPrefixMapper ...
func (PrefixMapper) Obj2Table ¶
func (mapper PrefixMapper) Obj2Table(name string) string
Obj2Table ...
func (PrefixMapper) Table2Obj ¶
func (mapper PrefixMapper) Table2Obj(name string) string
Table2Obj ...
type RetentionPolicy ¶
type RetentionPolicy struct { DBName string RPName string Duration string Replication int ShardDuration string Default bool }
RetentionPolicy ...
type SameMapper ¶
type SameMapper struct { }
SameMapper implements IMapper and provides same name between struct and database table
type Search ¶
type Search struct { Database *Database Result *ic.Response Err error // contains filtered or unexported fields }
Search ...
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session ...
func (*Session) CreateRetentionPolicy ¶
func (s *Session) CreateRetentionPolicy(rp RetentionPolicy) error
CreateRetentionPolicy ...
type SnakeMapper ¶
type SnakeMapper struct { }
SnakeMapper implements IMapper and provides name transaltion between struct and database table
func (SnakeMapper) Obj2Table ¶
func (mapper SnakeMapper) Obj2Table(name string) string
Obj2Table ...
func (SnakeMapper) Table2Obj ¶
func (mapper SnakeMapper) Table2Obj(name string) string
Table2Obj ...
type StructBean ¶
type StructBean struct {
// contains filtered or unexported fields
}
StructBean ...
type SuffixMapper ¶
SuffixMapper provide suffix table name support
func NewSuffixMapper ¶
func NewSuffixMapper(mapper IMapper, suffix string) SuffixMapper
NewSuffixMapper ...
func (SuffixMapper) Obj2Table ¶
func (mapper SuffixMapper) Obj2Table(name string) string
Obj2Table ...
func (SuffixMapper) Table2Obj ¶
func (mapper SuffixMapper) Table2Obj(name string) string
Table2Obj ...