driver

package
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2022 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const EntityIndex = "entity"

Variables

This section is empty.

Functions

This section is empty.

Types

type ESClient

type ESClient struct {
	Client *elastic.Client
}

func (*ESClient) BuildIndex

func (es *ESClient) BuildIndex(ctx context.Context, index, body string) error

func (*ESClient) Delete

func (es *ESClient) Delete(ctx context.Context, id string) error

func (*ESClient) DeleteByQuery

func (es *ESClient) DeleteByQuery(ctx context.Context, query map[string]interface{}) error

func (*ESClient) Search

func (es *ESClient) Search(ctx context.Context, req SearchRequest) (SearchResponse, error)

type SearchEngine

type SearchEngine interface {
	BuildIndex(ctx context.Context, index, content string) error
	Search(ctx context.Context, request SearchRequest) (SearchResponse, error)
	Delete(ctx context.Context, id string) error
}

func NewElasticsearchEngine

func NewElasticsearchEngine(cfg config.ESConfig) SearchEngine

type SearchRequest

type SearchRequest struct {
	Source    string                `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
	Owner     string                `protobuf:"bytes,2,opt,name=owner,proto3" json:"owner,omitempty"`
	Query     string                `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
	Page      *pb.Pager             `protobuf:"bytes,4,opt,name=page,proto3" json:"page,omitempty"`
	Condition []*pb.SearchCondition `protobuf:"bytes,5,rep,name=condition,proto3" json:"condition,omitempty"`
}

type SearchResponse

type SearchResponse struct {
	Total  int32                    `json:"total,omitempty"`
	Data   []map[string]interface{} `json:"data,omitempty"`
	Raw    []byte                   `json:"raw,omitempty"`
	Limit  int32                    `json:"limit"`
	Offset int32                    `json:"offset"`
}

type SelectDriveOption

type SelectDriveOption func() Type

func Parse

func Parse(drive string) SelectDriveOption

type Type

type Type string
const ElasticsearchDriver Type = "elasticsearch"

func Elasticsearch

func Elasticsearch() Type

func NoopDriver

func NoopDriver() Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL