inputs

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ES5

type ES5 struct {
	// contains filtered or unexported fields
}

func NewES5

func NewES5(input *config.Input) (*ES5, error)

func (*ES5) ClearScroll

func (e *ES5) ClearScroll(ctx context.Context, scrollID string)

func (*ES5) GetIndices

func (e *ES5) GetIndices(ctx context.Context) ([]string, error)

func (*ES5) GetIndicesAliases

func (e *ES5) GetIndicesAliases(ctx context.Context, indices string) (map[string][]string, error)

GetIndicesAliases 获取所有索引别名

func (*ES5) GetIndicesSetting

func (e *ES5) GetIndicesSetting(ctx context.Context, indices string) ([]byte, error)

func (*ES5) GetTemplates

func (e *ES5) GetTemplates(ctx context.Context) (map[string]any, error)

func (*ES5) ProcessIndicesData

func (e *ES5) ProcessIndicesData(ctx context.Context, options ...Option) error

ProcessIndicesData 处理索引数据 - 主入口,只负责流程编排

type FsInput

type FsInput struct {
	// contains filtered or unexported fields
}

func NewFsInput

func NewFsInput(input *config.Input) (*FsInput, error)

func (*FsInput) GetIndices

func (f *FsInput) GetIndices(ctx context.Context) ([]string, error)

func (*FsInput) GetIndicesAliases

func (f *FsInput) GetIndicesAliases(ctx context.Context, indices string) (map[string][]string, error)

func (*FsInput) GetIndicesSetting

func (f *FsInput) GetIndicesSetting(ctx context.Context, indices string) ([]byte, error)

func (*FsInput) GetTemplates

func (f *FsInput) GetTemplates(ctx context.Context) (map[string]any, error)

func (*FsInput) ProcessIndicesData

func (f *FsInput) ProcessIndicesData(ctx context.Context, options ...Option) error

type IInput

type IInput interface {
	GetTemplates(ctx context.Context) (map[string]any, error)
	GetIndices(ctx context.Context) ([]string, error)
	GetIndicesSetting(ctx context.Context, indices string) ([]byte, error)
	GetIndicesAliases(ctx context.Context, indices string) (map[string][]string, error)
	ProcessIndicesData(ctx context.Context, options ...Option) error
}

func New

func New(config *config.Input) (IInput, error)

type Option

type Option func(*Options)

func WithBuildBulkBodyProcess

func WithBuildBulkBodyProcess(fn func(bulkBody bytes.Buffer, scrollID string, docCount int) error) Option

WithBuildBulkBodyProcess 设置批量构建处理函数

func WithDocsProcess

func WithDocsProcess(fn func(docs []map[string]interface{}, scrollID string, docCount int)) Option

WithDocsProcess 设置文档处理函数

func WithOption

func WithOption(indices string, size int) Option

func WithQuery

func WithQuery(query string) Option

WithQuery 设置自定义DSL查询语句

func WithScrollID

func WithScrollID(scrollID string) Option

WithScrollID 设置滚动ID,用于后续滚动查询

type Options

type Options struct {
	Indices              string                                                             // 必填:索引名称,多个用逗号分隔
	Size                 int                                                                // 必填:每批次查询的数量,必须>0
	ScrollID             string                                                             // 可选:滚动ID,首次查询可为空
	Query                string                                                             // 可选:DSL查询语句,默认查询所有
	DocsProcess          func(docs []map[string]interface{}, scrollID string, docCount int) // 文档处理函数
	BuildBulkBodyProcess func(bulkBody bytes.Buffer, scrollID string, docCount int) error   // 批量构建处理函数
}

Options 用于配置索引数据滚动查询的所有参数

func GetOption

func GetOption(options ...Option) (*Options, error)

func (*Options) Validate

func (o *Options) Validate() error

Validate 严格校验Options必填参数

type ScrollConfig

type ScrollConfig struct {
	Index    string
	Size     int
	Query    string
	ScrollID string
	Timeout  time.Duration
}

ScrollConfig 滚动查询配置

Source Files

  • es5.go
  • fs.go
  • input.go
  • option.go

Jump to

Keyboard shortcuts

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