es

package
v1.3.4 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Elasticsearch

type Elasticsearch struct {
	Client  *elastic.Client
	Options *EsOption
}

func NewEs

func NewEs(esCli *elastic.Client, options *EsOption) (*Elasticsearch, error)

func (*Elasticsearch) AddRecord

func (e *Elasticsearch) AddRecord(index string, id int, title, remark, textData, tags string) (string, error)

添加记录

func (*Elasticsearch) DeleteRecord

func (e *Elasticsearch) DeleteRecord(index string, id int) error

删除一条

func (*Elasticsearch) GetRecord

func (e *Elasticsearch) GetRecord(index string, id int) (*Knowledge, error)

查询记录

func (*Elasticsearch) PageRecord

func (e *Elasticsearch) PageRecord(index string, size int, page int, keyword string) (int64, []int, error)

分页

func (*Elasticsearch) RecordList added in v1.2.2

func (e *Elasticsearch) RecordList(index string, keyword string) ([]int, error)

列表

func (*Elasticsearch) UpdateRecord

func (e *Elasticsearch) UpdateRecord(index string, id int, title, remark, textData, tags string) error

修改

type EsOption

type EsOption struct {
	Host  string
	Index string
	Type  string
}

type Knowledge

type Knowledge struct {
	Id       int    `json:"id"`
	Title    string `json:"title"`    // 标题
	Remark   string `json:"remark"`   // 摘要
	TextData string `json:"textData"` // 内容
	Tags     string `json:"tags"`     // 标签
}

Knowledge 数据结构体

Jump to

Keyboard shortcuts

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