example_example

package
v0.7.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const Thing2EsType = "Thing2"
View Source
const ThingEsType = "Thing"

Variables

View Source
var (
	AnEnumType_name = map[int32]string{
		0: "AN_ENUM_UNSPECIFIED",
		1: "AN_ENUM_ALPHA",
		2: "AN_ENUM_BRAVO",
	}
	AnEnumType_value = map[string]int32{
		"AN_ENUM_UNSPECIFIED": 0,
		"AN_ENUM_ALPHA":       1,
		"AN_ENUM_BRAVO":       2,
	}
)

Enum value maps for AnEnumType.

View Source
var ElasticsearchBulkIndexer esutil.BulkIndexer
View Source
var ElasticsearchClient *v8.Client
View Source
var ElasticsearchIndexName string
View Source
var File_example_proto protoreflect.FileDescriptor

Functions

func BulkDeleteSync added in v0.2.0

func BulkDeleteSync(ctx context.Context, ids []string, refresh string, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func BulkIndexSync added in v0.2.0

func BulkIndexSync(ctx context.Context, docs []Document, refresh string, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func EnsureIndex

func EnsureIndex(client *v8.Client) error

func GetClient added in v0.1.3

func GetClient() (*v8.Client, error)

func IndexSync

func IndexSync(ctx context.Context, docs []Document, refresh string) error

func Initialize added in v0.1.3

func Initialize(indexName, refresh string, addresses []string, numWorkers, flushBytes int, flushInterval, timeout time.Duration) error

func InitializeWithClients added in v0.1.3

func InitializeWithClients(indexName string, client *v8.Client, bulkIndexer esutil.BulkIndexer) error

func InitializeWithConfigs added in v0.1.3

func InitializeWithConfigs(indexName string, clientConfig *v8.Config, bulkIndexerConfig *esutil.BulkIndexerConfig) error

func InitializeWithDefaults added in v0.1.3

func InitializeWithDefaults(addresses []string) error

func QueueBulkIndexItem

func QueueBulkIndexItem(ctx context.Context, id, action string, body []byte, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func QueueDocForDeletion

func QueueDocForDeletion(ctx context.Context, doc Document, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func QueueDocForIndexing

func QueueDocForIndexing(ctx context.Context, doc Document, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func QueueDocsForDeletion

func QueueDocsForDeletion(ctx context.Context, docs []Document, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func QueueDocsForIndexing

func QueueDocsForIndexing(ctx context.Context, docs []Document, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

Types

type AnEnumType

type AnEnumType int32
const (
	AnEnumType_AN_ENUM_UNSPECIFIED AnEnumType = 0
	AnEnumType_AN_ENUM_ALPHA       AnEnumType = 1
	AnEnumType_AN_ENUM_BRAVO       AnEnumType = 2
)

func (AnEnumType) Descriptor

func (AnEnumType) Descriptor() protoreflect.EnumDescriptor

func (AnEnumType) Enum

func (x AnEnumType) Enum() *AnEnumType

func (AnEnumType) EnumDescriptor deprecated

func (AnEnumType) EnumDescriptor() ([]byte, []int)

Deprecated: Use AnEnumType.Descriptor instead.

func (AnEnumType) Number

func (x AnEnumType) Number() protoreflect.EnumNumber

func (AnEnumType) String

func (x AnEnumType) String() string

func (AnEnumType) Type

type Document

type Document struct {
	Id       string     `json:"id,omitempty"`
	Type     string     `json:"type,omitempty"`
	Metadata []Metadata `json:"metadata,omitempty"`
}

type Metadata

type Metadata struct {
	Key          *string  `json:"key,omitempty"`
	KeywordValue *string  `json:"keywordValue,omitempty"`
	StringValue  *string  `json:"stringValue,omitempty"`
	LongValue    *int64   `json:"longValue,omitempty"`
	DoubleValue  *float64 `json:"doubleValue,omitempty"`
	DateValue    *int64   `json:"dateValue,omitempty"`
	BoolValue    *bool    `json:"boolValue,omitempty"`
}

type Thing

type Thing struct {

	// @gotags: fake:"{uuid}"
	Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty" fake:"{uuid}"`
	// @gotags: fake:"{price:0.00,1000.00}"
	ADouble float64 `protobuf:"fixed64,2,opt,name=a_double,json=aDouble,proto3" json:"a_double,omitempty" fake:"{price:0.00,1000.00}"`
	// @gotags: fake:"{price:0.00,1000.00}"
	AFloat float32 `protobuf:"fixed32,3,opt,name=a_float,json=aFloat,proto3" json:"a_float,omitempty" fake:"{price:0.00,1000.00}"`
	// @gotags: fake:"{int32}"
	AnInt32 int32 `protobuf:"varint,4,opt,name=an_int32,json=anInt32,proto3" json:"an_int32,omitempty" fake:"{int32}"`
	// @gotags: fake:"{int64}"
	AnInt64 int64 `protobuf:"varint,5,opt,name=an_int64,json=anInt64,proto3" json:"an_int64,omitempty" fake:"{int64}"`
	// @gotags: fake:"{bool}"
	ABool bool `protobuf:"varint,14,opt,name=a_bool,json=aBool,proto3" json:"a_bool,omitempty" fake:"{bool}"`
	// @gotags: fake:"{hackerphrase}"
	AString string `protobuf:"bytes,15,opt,name=a_string,json=aString,proto3" json:"a_string,omitempty" fake:"{hackerphrase}"`
	// @gotags: fake:"skip"
	ABytes []byte `protobuf:"bytes,16,opt,name=a_bytes,json=aBytes,proto3" json:"a_bytes,omitempty" fake:"skip"`
	// @gotags: fake:"{hackerphrase}"
	RepeatedScalarField []string `` /* 143-byte string literal not displayed */
	// @gotags: fake:"skip"
	OptionalScalarField *string `` /* 139-byte string literal not displayed */
	// @gotags: fake:"skip"
	AssociatedThing *Thing2 `protobuf:"bytes,19,opt,name=associated_thing,json=associatedThing,proto3" json:"associated_thing,omitempty" fake:"skip"`
	// @gotags: fake:"skip"
	OptionalAssociatedThing *Thing2 `` /* 151-byte string literal not displayed */
	// @gotags: fake:"skip"
	RepeatedMessages []*Thing2 `protobuf:"bytes,21,rep,name=repeated_messages,json=repeatedMessages,proto3" json:"repeated_messages,omitempty" fake:"skip"`
	// @gotags: fake:"skip"
	ATimestamp *timestamppb.Timestamp `protobuf:"bytes,22,opt,name=a_timestamp,json=aTimestamp,proto3" json:"a_timestamp,omitempty" fake:"skip"`
	// @gotags: fake:"skip"
	AnIgnoredField string `protobuf:"bytes,23,opt,name=an_ignored_field,json=anIgnoredField,proto3" json:"an_ignored_field,omitempty" fake:"skip"`
	// @gotags: fake:"skip"
	AStructField *structpb.Struct `protobuf:"bytes,24,opt,name=a_struct_field,json=aStructField,proto3" json:"a_struct_field,omitempty" fake:"skip"`
	// @gotags: fake:"{number:1,2}"
	AnEnum AnEnumType `protobuf:"varint,25,opt,name=an_enum,json=anEnum,proto3,enum=test.AnEnumType" json:"an_enum,omitempty" fake:"{number:1,2}"`
	// @gotags: fake:"{number: 100,1000}"
	AnOptionalInt *int32 `` /* 136-byte string literal not displayed */
	// @gotags: fake:"skip"
	OptionalTimestamp *timestamppb.Timestamp `` /* 131-byte string literal not displayed */
	// @gotags: fake:"{int32}"
	RepeatedInt32 []int32 `protobuf:"varint,28,rep,packed,name=repeated_int32,json=repeatedInt32,proto3" json:"repeated_int32,omitempty" fake:"{int32}"`
	// @gotags: fake:"skip"
	AssociatedThingWithCascadeDelete *Thing2 `` /* 176-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*Thing) Delete

func (s *Thing) Delete(ctx context.Context, refresh string) error

func (*Thing) DeleteWithRefresh added in v0.1.3

func (s *Thing) DeleteWithRefresh(ctx context.Context) error

func (*Thing) Descriptor deprecated

func (*Thing) Descriptor() ([]byte, []int)

Deprecated: Use Thing.ProtoReflect.Descriptor instead.

func (*Thing) GetABool

func (x *Thing) GetABool() bool

func (*Thing) GetABytes

func (x *Thing) GetABytes() []byte

func (*Thing) GetADouble

func (x *Thing) GetADouble() float64

func (*Thing) GetAFloat

func (x *Thing) GetAFloat() float32

func (*Thing) GetAString

func (x *Thing) GetAString() string

func (*Thing) GetAStructField

func (x *Thing) GetAStructField() *structpb.Struct

func (*Thing) GetATimestamp

func (x *Thing) GetATimestamp() *timestamppb.Timestamp

func (*Thing) GetAnEnum

func (x *Thing) GetAnEnum() AnEnumType

func (*Thing) GetAnIgnoredField

func (x *Thing) GetAnIgnoredField() string

func (*Thing) GetAnInt32

func (x *Thing) GetAnInt32() int32

func (*Thing) GetAnInt64

func (x *Thing) GetAnInt64() int64

func (*Thing) GetAnOptionalInt

func (x *Thing) GetAnOptionalInt() int32

func (*Thing) GetAssociatedThing

func (x *Thing) GetAssociatedThing() *Thing2

func (*Thing) GetAssociatedThingWithCascadeDelete added in v0.3.0

func (x *Thing) GetAssociatedThingWithCascadeDelete() *Thing2

func (*Thing) GetId

func (x *Thing) GetId() string

func (*Thing) GetOptionalAssociatedThing

func (x *Thing) GetOptionalAssociatedThing() *Thing2

func (*Thing) GetOptionalScalarField

func (x *Thing) GetOptionalScalarField() string

func (*Thing) GetOptionalTimestamp

func (x *Thing) GetOptionalTimestamp() *timestamppb.Timestamp

func (*Thing) GetRepeatedInt32

func (x *Thing) GetRepeatedInt32() []int32

func (*Thing) GetRepeatedMessages

func (x *Thing) GetRepeatedMessages() []*Thing2

func (*Thing) GetRepeatedScalarField

func (x *Thing) GetRepeatedScalarField() []string

func (*Thing) IndexAsync

func (s *Thing) IndexAsync(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing) IndexSync

func (s *Thing) IndexSync(ctx context.Context, refresh string) error

func (*Thing) IndexSyncWithRefresh

func (s *Thing) IndexSyncWithRefresh(ctx context.Context) error

func (*Thing) MarshalJSON

func (msg *Thing) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Thing) ProtoMessage

func (*Thing) ProtoMessage()

func (*Thing) ProtoReflect

func (x *Thing) ProtoReflect() protoreflect.Message

func (*Thing) Reset

func (x *Thing) Reset()

func (*Thing) String

func (x *Thing) String() string

func (*Thing) ToEsDocuments

func (s *Thing) ToEsDocuments() ([]Document, error)

func (*Thing) UnmarshalJSON

func (msg *Thing) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type Thing2

type Thing2 struct {

	// @gotags: fake:"{uuid}"
	Id *string `protobuf:"bytes,1,opt,name=id,proto3,oneof" json:"id,omitempty" fake:"{uuid}"`
	// @gotags: fake:"{name}"
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty" fake:"{name}"`
	// contains filtered or unexported fields
}

func (*Thing2) Delete

func (s *Thing2) Delete(ctx context.Context, refresh string) error

func (*Thing2) DeleteRelatedDocumentsBulk added in v0.6.0

func (s *Thing2) DeleteRelatedDocumentsBulk(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error), bulkIndexer esutil.BulkIndexer) error

func (*Thing2) DeleteWithRefresh added in v0.1.3

func (s *Thing2) DeleteWithRefresh(ctx context.Context) error

func (*Thing2) Descriptor deprecated

func (*Thing2) Descriptor() ([]byte, []int)

Deprecated: Use Thing2.ProtoReflect.Descriptor instead.

func (*Thing2) GetId

func (x *Thing2) GetId() string

func (*Thing2) GetName

func (x *Thing2) GetName() string

func (*Thing2) IndexAsync

func (s *Thing2) IndexAsync(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing2) IndexSync

func (s *Thing2) IndexSync(ctx context.Context, refresh string) error

func (*Thing2) IndexSyncWithRefresh

func (s *Thing2) IndexSyncWithRefresh(ctx context.Context) error

func (*Thing2) MarshalJSON

func (msg *Thing2) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Thing2) ProtoMessage

func (*Thing2) ProtoMessage()

func (*Thing2) ProtoReflect

func (x *Thing2) ProtoReflect() protoreflect.Message

func (*Thing2) ReindexRelatedDocumentsAfterDeleteBulk added in v0.5.0

func (s *Thing2) ReindexRelatedDocumentsAfterDeleteBulk(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error), bulkIndexer esutil.BulkIndexer) error

func (*Thing2) ReindexRelatedDocumentsBulk added in v0.5.0

func (s *Thing2) ReindexRelatedDocumentsBulk(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error), bulkIndexer esutil.BulkIndexer) error

func (*Thing2) Reset

func (x *Thing2) Reset()

func (*Thing2) String

func (x *Thing2) String() string

func (*Thing2) ToEsDocuments

func (s *Thing2) ToEsDocuments() ([]Document, error)

func (*Thing2) UnmarshalJSON

func (msg *Thing2) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type Thing2BulkEsModel added in v0.2.0

type Thing2BulkEsModel []*Thing2

func (*Thing2BulkEsModel) Delete added in v0.2.0

func (s *Thing2BulkEsModel) Delete(ctx context.Context, refresh string, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing2BulkEsModel) DeleteWithRefresh added in v0.2.0

func (s *Thing2BulkEsModel) DeleteWithRefresh(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing2BulkEsModel) IndexAsync added in v0.2.0

func (s *Thing2BulkEsModel) IndexAsync(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing2BulkEsModel) IndexSync added in v0.2.0

func (s *Thing2BulkEsModel) IndexSync(ctx context.Context, refresh string, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing2BulkEsModel) IndexSyncWithRefresh added in v0.2.0

func (s *Thing2BulkEsModel) IndexSyncWithRefresh(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*Thing2BulkEsModel) ToEsDocuments added in v0.2.0

func (s *Thing2BulkEsModel) ToEsDocuments() ([]Document, error)

type ThingBulkEsModel added in v0.2.0

type ThingBulkEsModel []*Thing

func (*ThingBulkEsModel) Delete added in v0.2.0

func (s *ThingBulkEsModel) Delete(ctx context.Context, refresh string, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*ThingBulkEsModel) DeleteWithRefresh added in v0.2.0

func (s *ThingBulkEsModel) DeleteWithRefresh(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*ThingBulkEsModel) IndexAsync added in v0.2.0

func (s *ThingBulkEsModel) IndexAsync(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*ThingBulkEsModel) IndexSync added in v0.2.0

func (s *ThingBulkEsModel) IndexSync(ctx context.Context, refresh string, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*ThingBulkEsModel) IndexSyncWithRefresh added in v0.2.0

func (s *ThingBulkEsModel) IndexSyncWithRefresh(ctx context.Context, onSuccess func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem), onFailure func(ctx context.Context, item esutil.BulkIndexerItem, item2 esutil.BulkIndexerResponseItem, err error)) error

func (*ThingBulkEsModel) ToEsDocuments added in v0.2.0

func (s *ThingBulkEsModel) ToEsDocuments() ([]Document, error)

Jump to

Keyboard shortcuts

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