elasticsearch

package
v0.0.0-...-2b8ec9a Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 23 Imported by: 1

Documentation

Index

Constants

View Source
const IndexNameUser = "user"
View Source
const PrefixMinChars = 3

Variables

View Source
var DependencySet = wire.NewSet(
	NewClient,
	wire.Struct(new(Service), "*"),
	NewLogger,
	wire.Struct(new(Sink), "*"),
)

Functions

func CursorToSearchAfter

func CursorToSearchAfter(cursor model.PageCursor) (searchAfter interface{}, err error)

func MakeSearchBody

func MakeSearchBody(
	appID config.AppID,
	searchKeyword string,
	sortOption libuser.SortOption,
) map[string]interface{}

func NewClient

func NewClient(credentials *config.ElasticsearchCredentials) *elasticsearch.Client

func SortToCursor

func SortToCursor(sort interface{}) (cursor model.PageCursor, err error)

Types

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type Service

type Service struct {
	AppID     config.AppID
	Client    *elasticsearch.Client
	Users     UserQueries
	OAuth     *identityoauth.Store
	LoginID   *identityloginid.Store
	TaskQueue task.Queue
}

func (*Service) QueryUser

func (s *Service) QueryUser(
	searchKeyword string,
	sortOption libuser.SortOption,
	pageArgs graphqlutil.PageArgs,
) ([]model.PageItemRef, *Stats, error)

func (*Service) ReindexUser

func (s *Service) ReindexUser(userID string, isDelete bool) (err error)

type Sink

type Sink struct {
	Logger   Logger
	Service  Service
	Database *appdb.Handle
}

func (*Sink) ReceiveBlockingEvent

func (s *Sink) ReceiveBlockingEvent(e *event.Event) error

func (*Sink) ReceiveNonBlockingEvent

func (s *Sink) ReceiveNonBlockingEvent(e *event.Event) error

type Stats

type Stats struct {
	TotalCount int
}

type UserQueries

type UserQueries interface {
	Get(userID string, role accesscontrol.Role) (*model.User, error)
}

Jump to

Keyboard shortcuts

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