es

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 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(id int, title, remark, textData, tags string) (string, error)

添加记录

func (*Elasticsearch) DeleteRecord

func (e *Elasticsearch) DeleteRecord(id int) error

删除一条

func (*Elasticsearch) GetRecord

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

查询记录

func (*Elasticsearch) PageRecord

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

分页

func (*Elasticsearch) UpdateRecord

func (e *Elasticsearch) UpdateRecord(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