esdto

package
v1.0.1-dev-02 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: MulanPSL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const C_StatFieldName = "stats"

Variables

This section is empty.

Functions

func InjectEsAggResult

func InjectEsAggResult(s *EsAggResult)

func InjectEsRequest

func InjectEsRequest(s *EsRequest)

func InjectGetResultDto

func InjectGetResultDto(s *GetResultDto)

func InjectQueryGroup

func InjectQueryGroup(s *QueryGroup)

func InjectQueryList

func InjectQueryList(s *QueryList)

func LoadEsAggResult

func LoadEsAggResult() baseiface.ISingleton

func LoadEsRequest

func LoadEsRequest() baseiface.ISingleton

func LoadGetResultDto

func LoadGetResultDto() baseiface.ISingleton

func LoadQueryGroup

func LoadQueryGroup() baseiface.ISingleton

func LoadQueryList

func LoadQueryList() baseiface.ISingleton

Types

type AggType

type AggType int
const (
	AggType_AggStats AggType = iota + 100

	AggType_AggCount
	AggType_AggMax
	AggType_AggMin
	AggType_AggSum

	AggType_AggAvg

	AggType_Stats

	AggType_Count
	AggType_Max
	AggType_Min
	AggType_Sum

	AggType_Avg
)

func (AggType) IfAggAvg

func (self AggType) IfAggAvg() bool

func (AggType) IfAggCount

func (self AggType) IfAggCount() bool

func (AggType) IfAggMax

func (self AggType) IfAggMax() bool

func (AggType) IfAggMin

func (self AggType) IfAggMin() bool

func (AggType) IfAggStats

func (self AggType) IfAggStats() bool

func (AggType) IfAggSum

func (self AggType) IfAggSum() bool

func (AggType) String

func (self AggType) String() string

type EsAggDto

type EsAggDto struct {
	AggType AggType `json:"agg_type"`

	AggName    string          `json:"agg_name"`
	AggField   string          `json:"agg_field"`
	StatField  string          `json:"stat_field"`
	AggOrderBy *dto.OrderByDto `json:"agg_order_by"`
	Size       int             `json:"size"`
	UseKey     bool            `json:"use_key"`
}

func NewEsAggDto

func NewEsAggDto() *EsAggDto

func (*EsAggDto) IfAggSub

func (this *EsAggDto) IfAggSub() bool

func (*EsAggDto) IfStatFields

func (this *EsAggDto) IfStatFields() bool

func (*EsAggDto) StatFieldName

func (this *EsAggDto) StatFieldName(statF string) string

type EsAggResult

type EsAggResult struct {
	basedto.BaseEntity

	AggType   AggType `json:"agg_type"`
	Key       string  `json:"key"`           //"key": "722827384120016897",
	DocCount  int64   `json:"doc_count"`     //": 82,
	StatField string  `json:"stat_field"`    //"shop_account_id": {
	Count     int     `json:"count"`         //"count": 3,
	Min       any     `json:"min,omitempty"` //: 0.0,
	Max       any     `json:"max,omitempty"` //": 7.2344678761876685E17,
	Avg       any     `json:"avg,omitempty"` //": 2.41148929206255616E17,
	Sum       any     `json:"sum,omitempty"` //": 7.2344678761876685E17

	Value any `json:"value,omitempty"`
	Data  any `json:"data,omitempty"`

	EsAggResultMap map[string]*EsAggResult `json:"agg_map,omitempty"`
}

func FindBeanEsAggResult

func FindBeanEsAggResult() *EsAggResult

FindBeanEsAggResult

func NewEsAggResult

func NewEsAggResult() *EsAggResult

func (*EsAggResult) FromStatsResult

func (self *EsAggResult) FromStatsResult(stats StatsResult) *EsAggResult

func (*EsAggResult) ToAgg2Result

func (self *EsAggResult) ToAgg2Result(aggdto *EsAggDto, aggs elastic.Aggregations) *EsAggResult

func (*EsAggResult) ToAgg2ResultMap

func (self *EsAggResult) ToAgg2ResultMap(aggdto *EsAggDto, aggs elastic.Aggregations) *EsAggResult

func (*EsAggResult) ToAgg2ResultOne

func (self *EsAggResult) ToAgg2ResultOne(aggdto *EsAggDto, aggs elastic.Aggregations) *EsAggResult

func (*EsAggResult) Value2Stats

func (self *EsAggResult) Value2Stats()

type EsRequest

type EsRequest struct {
	basedto.BaseEntity
	RootDir  string                      `json:"-"`
	EsClient *ichubelastic.ElasticClient `json:"-"`

	CmdCategory esconst.CMDTYPE `json:"cmd_category"`
	ReqDto
}

func FindBeanEsRequest

func FindBeanEsRequest() *EsRequest

func NewEsRequest

func NewEsRequest() *EsRequest

func (*EsRequest) Client

func (this *EsRequest) Client() *elastic.Client

func (*EsRequest) FindAnyName

func (this *EsRequest) FindAnyName(data interface{}) string

func (*EsRequest) FullPath

func (this *EsRequest) FullPath(data interface{}) string

func (*EsRequest) Parse2IndexName

func (this *EsRequest) Parse2IndexName(data baseiface.IbaseProxy)

func (*EsRequest) Save2File

func (this *EsRequest) Save2File(datas ...baseiface.IbaseProxy)

func (*EsRequest) Save2FileBytes

func (this *EsRequest) Save2FileBytes(file string, proxy baseiface.IbaseProxy) error

func (*EsRequest) SaveFile

func (this *EsRequest) SaveFile()

type EsStats

type EsStats struct {
	//stats one filed
	Stats StatsResult `json:"stats,omitempty"`
	//stats multi fields
	StatsMap map[string]StatsResult `json:"stats_map,omitempty"`
}

func NewEsStats

func NewEsStats() *EsStats

func (*EsStats) Value2Stats

func (self *EsStats) Value2Stats(aggs elastic.Aggregations) *EsStats

func (*EsStats) Value2StatsMap

func (self *EsStats) Value2StatsMap(aggs elastic.Aggregations) *EsStats

type GetResultDto

type GetResultDto struct {
	basedto.BaseEntity

	Index       string      `json:"_index"`
	Type        string      `json:"_type"`
	Id          string      `json:"_id"`
	Uid         string      `json:"_uid"`
	Routing     string      `json:"_routing"`
	Parent      string      `json:"_parent"`
	Version     int         `json:"_version"`
	SeqNo       int         `json:"_seq_no"`
	PrimaryTerm int         `json:"_primary_term"`
	Source      interface{} `json:"_source"`
	Found       bool        `json:"found"`
}

func FindBeanGetResultDto

func FindBeanGetResultDto() *GetResultDto

func NewGetResultDto

func NewGetResultDto() *GetResultDto

func (*GetResultDto) As

func (this *GetResultDto) As(out interface{}) *GetResultDto

type QueryGroup

type QueryGroup struct {
	basedto.BaseEntity
	EsBoolType int
	Queries    []*elastic.Query
}

func FindBeanQueryGroup

func FindBeanQueryGroup() *QueryGroup

func NewQueryGroup

func NewQueryGroup() *QueryGroup

func (*QueryGroup) AddQuery

func (this *QueryGroup) AddQuery(query *elastic.Query)

type QueryList

type QueryList struct {
	basedto.BaseEntity
	// contains filtered or unexported fields
}

func FindBeanQueryList

func FindBeanQueryList() *QueryList

func NewQueryList

func NewQueryList() *QueryList

func (*QueryList) Append

func (this *QueryList) Append(query elastic.Query)

func (*QueryList) AppendFields

func (this *QueryList) AppendFields(page *page.PageRequest) []elastic.Query

type ReqDto

type ReqDto struct {
	IndexAlias string          `json:"index_alias"`
	IndexName  string          `json:"index_name"`
	CmdType    esconst.CMDTYPE `json:"cmd_type"`
	Source     string          `json:"source"`
	Timeout    int             `json:"timeout"`
	Id         string          `json:"id"`
	Ids        []string        `json:"ids"`
}

func NewReqDto

func NewReqDto() *ReqDto

type StatsResult

type StatsResult struct {
	Count int     `json:"count"`
	Min   float64 `json:"min"`
	Max   float64 `json:"max"`
	Avg   float64 `json:"avg"`
	Sum   float64 `json:"sum"`
}

Jump to

Keyboard shortcuts

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