elasticsearch

package
v0.0.0-...-c4f7e29 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

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

Variables

Functions

func CursorToSearchAfter

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

func MakeSearchBody

func MakeSearchBody(
	appID config.AppID,
	searchKeyword string,
	filterOptions libuser.FilterOptions,
	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 ElasticsearchServiceLogger

type ElasticsearchServiceLogger struct{ *log.Logger }

func NewElasticsearchServiceLogger

func NewElasticsearchServiceLogger(lf *log.Factory) *ElasticsearchServiceLogger

type Logger

type Logger struct{ *log.Logger }

func NewLogger

func NewLogger(lf *log.Factory) Logger

type ReindexRequest

type ReindexRequest struct {
	UserID string `json:"user_id"`
}

type ReindexResult

type ReindexResult struct {
	UserID       string `json:"user_id"`
	IsSuccess    bool   `json:"is_success"`
	ErrorMessage string `json:"error_message,omitempty"`
}

type Service

type Service struct {
	Clock       clock.Clock
	Context     context.Context
	Database    *appdb.Handle
	Logger      *ElasticsearchServiceLogger
	AppID       config.AppID
	Client      *elasticsearch.Client
	Users       UserQueries
	UserStore   *user.Store
	OAuth       *identityoauth.Store
	LoginID     *identityloginid.Store
	RolesGroups *rolesgroups.Store
	TaskQueue   task.Queue
	Producer    UserReindexCreateProducer
}

func (*Service) EnqueueReindexUserTask

func (s *Service) EnqueueReindexUserTask(userID string) error

func (*Service) ExecReindexUser

func (s *Service) ExecReindexUser(request ReindexRequest) (result ReindexResult)

func (*Service) MarkUsersAsReindexRequired

func (s *Service) MarkUsersAsReindexRequired(userIDs []string) error

func (*Service) QueryUser

func (s *Service) QueryUser(
	searchKeyword string,
	filterOptions libuser.FilterOptions,
	sortOption libuser.SortOption,
	pageArgs graphqlutil.PageArgs,
) ([]model.PageItemRef, *Stats, 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)
}

type UserReindexCreateProducer

type UserReindexCreateProducer interface {
	NewTask(appID string, input json.RawMessage) *redisqueue.Task
	EnqueueTask(ctx context.Context, task *redisqueue.Task) error
}

Jump to

Keyboard shortcuts

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