Documentation
¶
Overview ¶
Package hicon provides a client SDK for optimizing database queries through hicon query proxy.
MIT License - see LICENSE file for details.
Index ¶
- type BaseRequest
- type BaseResponse
- type BulkInsert
- func (s *BulkInsert) Cache(isCache bool) *BulkInsert
- func (s *BulkInsert) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *BulkInsert) ToOperation() *Operation
- func (s *BulkInsert) WithData(data []interface{}) *BulkInsert
- func (s *BulkInsert) WithLockKey(lockKey string) *BulkInsert
- type BulkUpdateByPK
- func (s *BulkUpdateByPK) Cache(isCache bool) *BulkUpdateByPK
- func (s *BulkUpdateByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *BulkUpdateByPK) ToOperation() *Operation
- func (s *BulkUpdateByPK) WithData(data []interface{}) *BulkUpdateByPK
- func (s *BulkUpdateByPK) WithLockKey(lockKey string) *BulkUpdateByPK
- func (s *BulkUpdateByPK) WithSet(columns ...string) *BulkUpdateByPK
- func (s *BulkUpdateByPK) WithWhere(columns ...string) *BulkUpdateByPK
- type BulkWriteWithTx
- type Client
- func (s *Client) NewBulkInsert(table string) *BulkInsert
- func (s *Client) NewBulkUpdateByPK(table string) *BulkUpdateByPK
- func (s *Client) NewBulkWriteWithTx(operations ...*Operation) *BulkWriteWithTx
- func (s *Client) NewDeleteByPK(table string) *DeleteByPK
- func (s *Client) NewExec(sql string, args ...interface{}) *Exec
- func (s *Client) NewFindAll(table string) *FindAll
- func (s *Client) NewFindByPK(table string) *FindByPK
- func (s *Client) NewFindOne(table string) *FindOne
- func (s *Client) NewUpdateAll(table string) *UpdateAll
- func (s *Client) NewUpdateByPK(table string) *UpdateByPK
- func (s *Client) NewUpsertConfig(opts ...UpsertConfigOption) *UpsertConfig
- type Column
- type DBConfig
- type DeleteByPK
- func (s *DeleteByPK) Cache(isCache bool) *DeleteByPK
- func (s *DeleteByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *DeleteByPK) ToOperation() *Operation
- func (s *DeleteByPK) WithData(data interface{}) *DeleteByPK
- func (s *DeleteByPK) WithForceDelete(forceDelete bool) *DeleteByPK
- func (s *DeleteByPK) WithLockKey(lockKey string) *DeleteByPK
- func (s *DeleteByPK) WithWhere(query string, args ...interface{}) *DeleteByPK
- type Exec
- type ExecOptions
- type FindAll
- func (s *FindAll) Cache(isCache bool) *FindAll
- func (s *FindAll) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *FindAll) Join(query string, args ...interface{}) *FindAll
- func (s *FindAll) Relation(relation ...string) *FindAll
- func (s *FindAll) WithLimit(limit int) *FindAll
- func (s *FindAll) WithOffset(offset int) *FindAll
- func (s *FindAll) WithOrderBy(orderBy string) *FindAll
- func (s *FindAll) WithSelects(columns ...string) *FindAll
- func (s *FindAll) WithWhere(query string, args ...interface{}) *FindAll
- func (s *FindAll) WithWhereAllWithDeleted() *FindAll
- type FindByPK
- func (s *FindByPK) Cache(isCache bool) *FindByPK
- func (s *FindByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *FindByPK) WithData(data interface{}) *FindByPK
- func (s *FindByPK) WithSelects(columns ...string) *FindByPK
- func (s *FindByPK) WithWhereAllWithDeleted() *FindByPK
- type FindOne
- func (s *FindOne) Cache(isCache bool) *FindOne
- func (s *FindOne) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *FindOne) Join(query string, args ...interface{}) *FindOne
- func (s *FindOne) Relation(relation ...string) *FindOne
- func (s *FindOne) WithOffset(offset int) *FindOne
- func (s *FindOne) WithOrderBy(orderBy string) *FindOne
- func (s *FindOne) WithSelects(columns ...string) *FindOne
- func (s *FindOne) WithWhere(query string, args ...interface{}) *FindOne
- func (s *FindOne) WithWhereAllWithDeleted() *FindOne
- type Join
- type Operation
- type QueryWithArgs
- type Redis
- type RelationColumn
- type TLS
- type TableConfig
- type UpdateAll
- func (s *UpdateAll) Cache(isCache bool) *UpdateAll
- func (s *UpdateAll) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *UpdateAll) ToOperation() *Operation
- func (s *UpdateAll) WithLockKey(lockKey string) *UpdateAll
- func (s *UpdateAll) WithSet(query string, args ...interface{}) *UpdateAll
- func (s *UpdateAll) WithWhere(query string, args ...interface{}) *UpdateAll
- func (s *UpdateAll) WithWhereAllWithDeleted() *UpdateAll
- type UpdateByPK
- func (s *UpdateByPK) Cache(isCache bool) *UpdateByPK
- func (s *UpdateByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
- func (s *UpdateByPK) ToOperation() *Operation
- func (s *UpdateByPK) WithData(data interface{}) *UpdateByPK
- func (s *UpdateByPK) WithLockKey(lockKey string) *UpdateByPK
- func (s *UpdateByPK) WithWhere(query string, args ...interface{}) *UpdateByPK
- type UpsertConfig
- type UpsertConfigOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseRequest ¶
type BaseResponse ¶ added in v1.1.0
type BulkInsert ¶
func (*BulkInsert) Cache ¶ added in v1.1.6
func (s *BulkInsert) Cache(isCache bool) *BulkInsert
func (*BulkInsert) Exec ¶
func (s *BulkInsert) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*BulkInsert) ToOperation ¶
func (s *BulkInsert) ToOperation() *Operation
func (*BulkInsert) WithData ¶ added in v1.1.6
func (s *BulkInsert) WithData(data []interface{}) *BulkInsert
func (*BulkInsert) WithLockKey ¶
func (s *BulkInsert) WithLockKey(lockKey string) *BulkInsert
type BulkUpdateByPK ¶
type BulkUpdateByPK struct {
// Lock key for concurrent insert operations
// The later task with the same lock key in the same time will not execute and get the result from the first task
LockKey string
Table string
Set []string
Where []string
Data interface{}
DisableCache bool
}
func (*BulkUpdateByPK) Cache ¶ added in v1.1.6
func (s *BulkUpdateByPK) Cache(isCache bool) *BulkUpdateByPK
func (*BulkUpdateByPK) Exec ¶
func (s *BulkUpdateByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*BulkUpdateByPK) ToOperation ¶
func (s *BulkUpdateByPK) ToOperation() *Operation
func (*BulkUpdateByPK) WithData ¶ added in v1.1.6
func (s *BulkUpdateByPK) WithData(data []interface{}) *BulkUpdateByPK
func (*BulkUpdateByPK) WithLockKey ¶
func (s *BulkUpdateByPK) WithLockKey(lockKey string) *BulkUpdateByPK
func (*BulkUpdateByPK) WithSet ¶ added in v1.1.6
func (s *BulkUpdateByPK) WithSet(columns ...string) *BulkUpdateByPK
func (*BulkUpdateByPK) WithWhere ¶ added in v1.1.6
func (s *BulkUpdateByPK) WithWhere(columns ...string) *BulkUpdateByPK
type BulkWriteWithTx ¶
func (*BulkWriteWithTx) Exec ¶
func (s *BulkWriteWithTx) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*BulkWriteWithTx) WithLockKey ¶
func (s *BulkWriteWithTx) WithLockKey(lockKey string) *BulkWriteWithTx
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) NewBulkInsert ¶
func (s *Client) NewBulkInsert(table string) *BulkInsert
func (*Client) NewBulkUpdateByPK ¶
func (s *Client) NewBulkUpdateByPK(table string) *BulkUpdateByPK
func (*Client) NewBulkWriteWithTx ¶
func (s *Client) NewBulkWriteWithTx(operations ...*Operation) *BulkWriteWithTx
func (*Client) NewDeleteByPK ¶
func (s *Client) NewDeleteByPK(table string) *DeleteByPK
func (*Client) NewFindAll ¶
func (*Client) NewFindByPK ¶
func (*Client) NewFindOne ¶
func (*Client) NewUpdateAll ¶
func (*Client) NewUpdateByPK ¶
func (s *Client) NewUpdateByPK(table string) *UpdateByPK
func (*Client) NewUpsertConfig ¶
func (s *Client) NewUpsertConfig(opts ...UpsertConfigOption) *UpsertConfig
NewUpsertConfig New creates a new NewUpsertConfig with default settings
type DeleteByPK ¶
type DeleteByPK struct {
// Lock key for concurrent insert operations
// The later task with the same lock key in the same time will not execute and get the result from the first task
LockKey string
Table string
Data interface{}
Where []*QueryWithArgs
DisableCache bool
ForceDelete bool // if enable soft delete in table
}
func (*DeleteByPK) Cache ¶ added in v1.1.6
func (s *DeleteByPK) Cache(isCache bool) *DeleteByPK
func (*DeleteByPK) Exec ¶
func (s *DeleteByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*DeleteByPK) ToOperation ¶
func (s *DeleteByPK) ToOperation() *Operation
func (*DeleteByPK) WithData ¶ added in v1.1.6
func (s *DeleteByPK) WithData(data interface{}) *DeleteByPK
func (*DeleteByPK) WithForceDelete ¶ added in v1.1.6
func (s *DeleteByPK) WithForceDelete(forceDelete bool) *DeleteByPK
func (*DeleteByPK) WithLockKey ¶
func (s *DeleteByPK) WithLockKey(lockKey string) *DeleteByPK
func (*DeleteByPK) WithWhere ¶ added in v1.1.6
func (s *DeleteByPK) WithWhere(query string, args ...interface{}) *DeleteByPK
type Exec ¶
func (*Exec) Exec ¶
func (s *Exec) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*Exec) ToOperation ¶
func (*Exec) WithLockKey ¶
type ExecOptions ¶ added in v1.1.0
type ExecOptions struct {
RequestID string
}
type FindAll ¶
type FindAll struct {
Table string
DisableCache bool
Selects []string
Where []*QueryWithArgs
Relations []string
Joins []*Join
Limit int
Offset int
OrderBy []string
WhereAllWithDeleted bool
}
func (*FindAll) Exec ¶
func (s *FindAll) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*FindAll) WithOffset ¶ added in v1.1.6
func (*FindAll) WithOrderBy ¶ added in v1.1.6
func (*FindAll) WithSelects ¶ added in v1.1.6
func (*FindAll) WithWhereAllWithDeleted ¶ added in v1.1.6
type FindByPK ¶
type FindByPK struct {
Table string
DisableCache bool
Selects []string
Data interface{}
WhereAllWithDeleted bool
}
func (*FindByPK) Exec ¶
func (s *FindByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*FindByPK) WithSelects ¶ added in v1.1.6
func (*FindByPK) WithWhereAllWithDeleted ¶ added in v1.1.6
type FindOne ¶
type FindOne struct {
Table string
DisableCache bool
Selects []string
Where []*QueryWithArgs
Relations []string
Joins []*Join
Offset int
OrderBy []string
WhereAllWithDeleted bool
}
func (*FindOne) Exec ¶
func (s *FindOne) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*FindOne) WithOffset ¶ added in v1.1.6
func (*FindOne) WithOrderBy ¶ added in v1.1.6
func (*FindOne) WithSelects ¶ added in v1.1.6
func (*FindOne) WithWhereAllWithDeleted ¶ added in v1.1.6
type QueryWithArgs ¶
type QueryWithArgs struct {
Query string
Args []interface{}
}
type RelationColumn ¶
type RelationColumn struct {
Name string
RefTable string
Type constant.RelationType
Join string
}
type TableConfig ¶
type TableConfig struct {
Name string
Columns []*Column
RelationColumns []*RelationColumn
}
type UpdateAll ¶
type UpdateAll struct {
// Lock key for concurrent insert operations
// The later task with the same lock key in the same time will not execute and get the result from the first task
LockKey string
Table string
Where []*QueryWithArgs
Set []*QueryWithArgs
WhereAllWithDeleted bool
DisableCache bool
}
func (*UpdateAll) Exec ¶
func (s *UpdateAll) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*UpdateAll) ToOperation ¶
func (*UpdateAll) WithLockKey ¶
func (*UpdateAll) WithWhereAllWithDeleted ¶ added in v1.1.6
type UpdateByPK ¶
type UpdateByPK struct {
// Lock key for concurrent insert operations
// The later task with the same lock key in the same time will not execute and get the result from the first task
LockKey string
Table string
Data interface{}
Where []*QueryWithArgs
DisableCache bool
}
func (*UpdateByPK) Cache ¶ added in v1.1.6
func (s *UpdateByPK) Cache(isCache bool) *UpdateByPK
func (*UpdateByPK) Exec ¶
func (s *UpdateByPK) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
func (*UpdateByPK) ToOperation ¶
func (s *UpdateByPK) ToOperation() *Operation
func (*UpdateByPK) WithData ¶ added in v1.1.6
func (s *UpdateByPK) WithData(data interface{}) *UpdateByPK
func (*UpdateByPK) WithLockKey ¶
func (s *UpdateByPK) WithLockKey(lockKey string) *UpdateByPK
func (*UpdateByPK) WithWhere ¶ added in v1.1.6
func (s *UpdateByPK) WithWhere(query string, args ...interface{}) *UpdateByPK
type UpsertConfig ¶
type UpsertConfig struct {
DBConfig *DBConfig
Redis *Redis
TableConfigs []*TableConfig
Debug bool
DisableCache bool
}
func (*UpsertConfig) Exec ¶
func (s *UpsertConfig) Exec(ctx context.Context, opts *ExecOptions) (r *BaseResponse, err error)
Exec finalize the configuration
type UpsertConfigOption ¶
type UpsertConfigOption func(config *UpsertConfig)
UpsertConfigOption is a functional configuration option type
func Cache ¶ added in v1.1.6
func Cache(cache bool) UpsertConfigOption
Cache toggles cache functionality
func WithDBConfig ¶
func WithDBConfig(dbConfig *DBConfig) UpsertConfigOption
WithDBConfig WithDB Database configuration methods
func WithDebug ¶
func WithDebug(debug bool) UpsertConfigOption
WithDebug enables or disables debug mode
func WithRedis ¶
func WithRedis(redis *Redis) UpsertConfigOption
WithRedis Redis configuration methods
func WithTable ¶
func WithTable(tbl *TableConfig) UpsertConfigOption
WithTable adds a table configuration
Source Files
¶
Click to show internal directories.
Click to hide internal directories.