Documentation
¶
Index ¶
- Constants
- Variables
- type Arg
- type Body
- func (b Body) Marshal() (body []byte, err error)
- func (b Body) WithArgs(args ...Arg)
- func (b Body) WithCursor(cursor string)
- func (b Body) WithFetchSize(size int64)
- func (b Body) WithProperties(properties result.MappingProperties)
- func (b Body) WithQuery(query any)
- func (b Body) WithSql(sqlStr string, args ...any)
- type BulkCreate
- type BulkDelete
- type BulkIndex
- type BulkItem
- func (bi *BulkItem) Marshal() []byte
- func (bi *BulkItem) WithCreate(index, id string, property Property) *BulkItem
- func (bi *BulkItem) WithDelete(index, id string) *BulkItem
- func (bi *BulkItem) WithIndex(index, id string, property Property) *BulkItem
- func (bi *BulkItem) WithUpdate(index, id string, property Updater) *BulkItem
- type BulkMarshal
- type BulkUpdate
- type Options
- type OrderItem
- type Pool
- func (p *Pool) Bulk(ctx context.Context, bi *BulkItem) (res *result.Bulk, err error)
- func (p *Pool) CloseSqlCursor(ctx context.Context, cursor string) (response *http_client.Response, err error)
- func (p *Pool) DocDel(ctx context.Context, indexName, id string) (res *result.DocIndex, err error)
- func (p *Pool) DocFieldIncr(ctx context.Context, indexName, id, field string, increment int64) (res *result.DocIndex, err error)
- func (p *Pool) DocIndex(ctx context.Context, indexName string, body Body) (res *result.DocIndex, err error)
- func (p *Pool) DocIndexWithId(ctx context.Context, indexName, id string, body Body) (res *result.DocIndex, err error)
- func (p *Pool) DocMGet(ctx context.Context, indexName string, idList ...string) (res *result.Documents, err error)
- func (p *Pool) DocUpdate(ctx context.Context, indexName, id string, setter Setter) (res *result.DocIndex, err error)
- func (p *Pool) DocUpdateWithOptimistic(ctx context.Context, indexName, id string, setter Setter, ...) (res *result.DocIndex, err error)
- func (p *Pool) Index(ctx context.Context, name string, args ...Arg) (res *result.Index, err error)
- func (p *Pool) IndexDel(ctx context.Context, name string) (res *result.Index, err error)
- func (p *Pool) IndexMapping(ctx context.Context, name string, properties result.MappingProperties) (res *result.Index, err error)
- func (p *Pool) IndexMappingGet(ctx context.Context, target string) (res *result.IndexMapping, err error)
- func (p *Pool) IndexSetting(ctx context.Context, name string, args ...Arg) (res *result.Index, err error)
- func (p *Pool) IndexSettingGet(ctx context.Context, target string) (response *http_client.Response, err error)
- func (p *Pool) Options() Options
- func (p *Pool) QueryWithCursor(ctx context.Context, cursor, format string, args ...Arg) (res *result.Sql, err error)
- func (p *Pool) QueryWithDsl(ctx context.Context, indexName string, qs *QueryDsl) (*result.Search, error)
- func (p *Pool) QueryWithString(ctx context.Context, indexName string, qs *QueryString) (*result.Search, error)
- func (p *Pool) Request(ctx context.Context, method, path string, body []byte, ...) (response *http_client.Response, err error)
- func (p *Pool) SearchBySql(ctx context.Context, size int64, format, sqlStr string, params []any, ...) (res *result.Sql, err error)
- type Properties
- type Property
- type QueryDsl
- type QueryString
- type Setter
- type Sort
- type SortItem
- type String
- type StringQuery
- type Updater
Constants ¶
View Source
const ( SortAsc = `asc` SortDesc = `desc` )
Variables ¶
View Source
var ( ErrArgsEmpty = errors.New("args is empty") ErrSetterEmpty = errors.New("setter is empty") ErrPropertiesEmpty = errors.New("properties is empty") ErrIndexNotExists = errors.New("no such index") )
View Source
var (
DefaultPageSize int64 = 15
)
Functions ¶
This section is empty.
Types ¶
type Body ¶
func (Body) WithCursor ¶
func (Body) WithFetchSize ¶
func (Body) WithProperties ¶
func (b Body) WithProperties(properties result.MappingProperties)
type BulkCreate ¶
type BulkCreate struct {
// contains filtered or unexported fields
}
func (*BulkCreate) Marshal ¶
func (bc *BulkCreate) Marshal() []byte
type BulkDelete ¶
type BulkDelete struct {
// contains filtered or unexported fields
}
func (*BulkDelete) Marshal ¶
func (bc *BulkDelete) Marshal() []byte
type BulkItem ¶
type BulkItem struct {
// contains filtered or unexported fields
}
func NewBulkItem ¶
func NewBulkItem(items ...BulkMarshal) *BulkItem
func (*BulkItem) WithCreate ¶
func (*BulkItem) WithDelete ¶
type BulkMarshal ¶
type BulkMarshal interface {
Marshal() []byte
}
type BulkUpdate ¶
type BulkUpdate struct {
// contains filtered or unexported fields
}
func (*BulkUpdate) Marshal ¶
func (bu *BulkUpdate) Marshal() []byte
type Options ¶
type Options struct { BaseUrl string `json:"baseUrl" yaml:"baseUrl"` UserName string `json:"userName" yaml:"userName"` Password string `json:"password" yaml:"password"` MaxIdleConns int `json:"maxIdleConns" yaml:"maxIdleConns"` MaxOpenConns int `json:"maxOpenConns" yaml:"maxOpenConns"` TimeoutSec int `json:"timeoutSec" yaml:"timeoutSec"` DialTimeoutSec int `json:"dialTimeoutSec" yaml:"dialTimeoutSec"` KeepaliveSec int `json:"keepaliveSec" yaml:"keepaliveSec"` ConnMaxIdleTimeSec int `json:"connMaxIdleTimeSec" yaml:"connMaxIdleTimeSec"` ConnMaxLifetimeSec int `json:"connMaxLifetimeSec" yaml:"connMaxLifetimeSec"` ReadBufferSize int `json:"readBufferSize" yaml:"readBufferSize"` WriteBufferSize int `json:"writeBufferSize" yaml:"writeBufferSize"` }
func DefaultOption ¶
func DefaultOption() Options
func OptionsWithJson ¶
func OptionsWithYaml ¶
func (*Options) ConnMaxIdleTime ¶
func (*Options) ConnMaxLifetime ¶
func (*Options) DialTimeout ¶
func (*Options) KeepaliveTime ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) CloseSqlCursor ¶
func (*Pool) DocFieldIncr ¶
func (*Pool) DocIndexWithId ¶
func (*Pool) DocUpdateWithOptimistic ¶
func (*Pool) IndexMapping ¶
func (*Pool) IndexMappingGet ¶
func (*Pool) IndexSetting ¶
func (*Pool) IndexSettingGet ¶
func (*Pool) QueryWithCursor ¶
func (*Pool) QueryWithDsl ¶
func (*Pool) QueryWithString ¶
type Properties ¶
func (Properties) WithProperty ¶
func (p Properties) WithProperty(field string, prop Property)
type QueryString ¶
type QueryString struct { Query StringQuery `json:"query"` From int64 `json:"from"` Size int64 `json:"size,omitempty"` Source any `json:"_source,omitempty"` Sort Sort `json:"sort,omitempty"` SearchAfter []any `json:"search_after,omitempty"` }
func NewQueryString ¶
func NewQueryString(q string) *QueryString
func (*QueryString) SetQuery ¶
func (qs *QueryString) SetQuery(q string) *QueryString
type StringQuery ¶
type StringQuery struct {
QueryString String `json:"query_string"`
}
Source Files
¶
Click to show internal directories.
Click to hide internal directories.