types

package
v0.0.0-...-080b9e8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2025 License: Apache-2.0 Imports: 6 Imported by: 23

Documentation

Index

Constants

View Source
const (
	SCOPE_ALL     = "all"
	SCOPE_IN      = "in"
	SCOPE_OUT     = "out"
	SCOPE_NONE    = "none"
	SCOPE_UNKNOWN = "unknown"
)

Scopes constants

View Source
const (
	STATE_ALL     = "all"
	STATE_PENDING = "pending"
	STATE_DONE    = "done"
)

States constants

View Source
const (
	USERS_ALL  = "all"
	USERS_IN   = "in"
	USERS_OUT  = "out"
	USERS_NONE = "none"
)

user notifications constants

View Source
const (
	Auto = iota
	Manual
)

Variables

This section is empty.

Functions

func NewOptions

func NewOptions() *options

NewOptions instanciates new Options with default values

func NewQueryOptions

func NewQueryOptions() *queryOptions

NewQueryOptions instanciates a new QueryOptions with default values

Types

type CollectionsList

type CollectionsList struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type Controller

type Controller struct {
	Actions map[string]bool `json:"actions"`
}

type Controllers

type Controllers struct {
	Controllers map[string]*Controller `json:"controllers"`
}

type CredentialFields

type CredentialFields map[string]CredentialStrategyFields

type CredentialStrategyFields

type CredentialStrategyFields []string

type Credentials

type Credentials = json.RawMessage

type GeoPoint

type GeoPoint struct {
	Lon  float64 `json:"lon"`
	Lat  float64 `json:"lat"`
	Name string  `json:"name"`
}

type Georadius

type Georadius struct {
	Name string
	Lon  float64
	Lat  float64
	Dist float64
}

type IKuzzle

type IKuzzle interface {
	Query(query *KuzzleRequest, options QueryOptions, responseChannel chan<- *KuzzleResponse)
	EmitEvent(int, interface{})
	SetJwt(string)
	RegisterSub(string, string, json.RawMessage, bool, chan<- NotificationResult, chan<- interface{})
	UnregisterSub(string)
	AddListener(event int, notifChan chan<- json.RawMessage)
	AutoResubscribe() bool
}

type IRoom

type IRoom interface {
	Subscribe(realtimeNotificationChannel chan<- NotificationResult)
	Unsubscribe() error
	RealtimeChannel() chan<- NotificationResult
	ResponseChannel() chan SubscribeResponse
	RoomId() string
	Filters() interface{}
	Channel() string
	Id() string
	SubscribeToSelf() bool
}

IRoom provides functions to manage Room

type KuzzleError

type KuzzleError struct {
	Message string `json:"message"`
	Stack   string `json:"stack"`
	Status  int    `json:"status"`
}

KuzzleError is a custom Error type for Kuzzle

func NewError

func NewError(msg string, status ...int) KuzzleError

NewError instanciates a new KuzzleError

func (KuzzleError) Error

func (e KuzzleError) Error() string

type KuzzleRequest

type KuzzleRequest struct {
	RequestId    string                 `json:"requestId,omitempty"`
	Controller   string                 `json:"controller,omitempty"`
	Action       string                 `json:"action,omitempty"`
	Index        string                 `json:"index,omitempty"`
	Collection   string                 `json:"collection,omitempty"`
	Body         interface{}            `json:"body"`
	Id           string                 `json:"_id,omitempty"`
	From         int                    `json:"from"`
	Size         int                    `json:"size"`
	Scroll       string                 `json:"scroll,omitempty"`
	ScrollId     string                 `json:"scrollId,omitempty"`
	Strategy     string                 `json:"strategy,omitempty"`
	ExpiresIn    int                    `json:"expiresIn,omitempty"`
	Volatile     VolatileData           `json:"volatile"`
	Scope        string                 `json:"scope"`
	State        string                 `json:"state"`
	Users        string                 `json:"users"`
	Start        int                    `json:"start,omitempty"`
	Stop         int                    `json:"stop,omitempty"`
	End          int                    `json:"end,omitempty"`
	Bit          int                    `json:"bit,omitempty"`
	Member       string                 `json:"member,omitempty"`
	Member1      string                 `json:"member1,omitempty"`
	Member2      string                 `json:"member2,omitempty"`
	Members      []string               `json:"members,omitempty"`
	Lon          float64                `json:"lon,omitempty"`
	Lat          float64                `json:"lat,omitempty"`
	Distance     float64                `json:"distance,omitempty"`
	Unit         string                 `json:"unit,omitempty"`
	Options      []interface{}          `json:"options,omitempty"`
	Keys         []string               `json:"keys,omitempty"`
	Cursor       int                    `json:"cursor,omitempty"`
	Offset       int                    `json:"offset,omitempty"`
	Field        string                 `json:"field,omitempty"`
	Fields       []string               `json:"fields,omitempty"`
	Subcommand   string                 `json:"subcommand,omitempty"`
	Pattern      string                 `json:"pattern,omitempty"`
	Idx          int                    `json:"idx, omitempty"`
	Min          string                 `json:"min,omitempty"`
	Max          string                 `json:"max,omitempty"`
	Limit        string                 `json:"limit,omitempty"`
	Count        int                    `json:"count,omitempty"`
	Match        string                 `json:"match,omitempty"`
	Reset        bool                   `json:"reset,omitempty"`
	IncludeTrash bool                   `json:"includeTrash,omitempty"`
	CustomArgs   map[string]interface{} `json:"-"`
}

func (*KuzzleRequest) AddCustomArg

func (kr *KuzzleRequest) AddCustomArg(k string, v interface{})

type KuzzleResponse

type KuzzleResponse struct {
	RequestId  string          `json:"requestId"`
	Result     json.RawMessage `json:"result"`
	Volatile   VolatileData    `json:"volatile"`
	Index      string          `json:"index"`
	Collection string          `json:"collection"`
	Controller string          `json:"controller"`
	Action     string          `json:"action"`
	RoomId     string          `json:"room"`
	Channel    string          `json:"channel"`
	Status     int             `json:"status"`
	Error      KuzzleError     `json:"error"`
}

KuzzleResponse is a response to a KuzzleRequest

type LoginAttempt

type LoginAttempt struct {
	Success bool  `json:"success"`
	Error   error `json:"error"`
}

type MSKeyValue

type MSKeyValue struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

type MSScanResponse

type MSScanResponse struct {
	Cursor int      `json:"cursor"`
	Values []string `json:"values"`
}

type MSSortedSet

type MSSortedSet struct {
	Score  float64 `json:"score"`
	Member string  `json:"member"`
}

type MappingField

type MappingField struct {
	Analyzer                 string      `json:"analyzer,omitempty"`
	Normalizer               interface{} `json:"normalizer,omitempty"`
	DocValues                bool        `json:"doc_values,omitempty"`
	Boost                    float64     `json:"boost,omitempty"`
	Coerce                   bool        `json:"coerce,omitempty"`
	Enabled                  bool        `json:"enabled,omitempty"`
	FieldData                bool        `json:"fielddata,omitempty"`
	FieldDataFrequencyFilter struct {
		Min            float64 `json:"min,omitempty"`
		Max            float64 `json:"max,omitempty"`
		MinSegmentSize int     `json:"min_segment_size,omitempty"`
	} `json:"fielddata_frequency_filter,omitempty"`
	Format               string                  `json:"format,omitempty"`
	IgnoreAbove          int                     `json:"ignore_above,omitempty"`
	IgnoreMalformed      bool                    `json:"ignore_malformed,omitempty"`
	IncludeInAll         bool                    `json:"include_in_all,omitempty"`
	Index                bool                    `json:"index,omitempty"`
	IndexOptions         bool                    `json:"index_options,omitempty"`
	Fields               map[string]MappingField `json:"fields,omitempty"`
	Norms                bool                    `json:"norms,omitempty"`
	NullValue            bool                    `json:"null_value,omitempty"`
	PositionIncrementGap bool                    `json:"position_increment_gap,omitempty"`
	Type                 string                  `json:"type,omitempty"`
	All                  *struct {
		Enabled bool   `json:"enabled,omitempty"`
		Format  string `json:"format, omitempty"`
	} `json:"_all,omitempty"`
	Properties               MappingFields          `json:"properties,omitempty"`
	SearchAnalyzer           string                 `json:"search_analyzer,omitempty"`
	Similarity               string                 `json:"similarity,omitempty"`
	Store                    bool                   `json:"store,omitempty"`
	TermVector               string                 `json:"term_vector,omitempty"`
	Tree                     string                 `json:"tree,omitempty"`
	Precision                string                 `json:"precision,omitempty"`
	TreeLevels               int                    `json:"tree_levels,omitempty"`
	Strategy                 string                 `json:"strategy,omitempty"`
	DistanceErrorPct         float64                `json:"distance_error_pct,omitempty"`
	Orientation              string                 `json:"orientation,omitempty"`
	PointsOnly               bool                   `json:"points_only,omitempty"`
	EagerGlobalOrdinals      bool                   `json:"eager_global_ordinals,omitempty"`
	Dynamic                  interface{}            `json:"dynamic,omitempty"`
	SearchQuoteAnalyzer      string                 `json:"search_quote_analyzer,omitempty"`
	EnablePositionIncrements bool                   `json:"enable_position_increments,omitempty"`
	Relations                map[string]interface{} `json:"relations,omitempty"`
}

type MappingFields

type MappingFields map[string]MappingField

type Meta

type Meta struct {
	Author    string `json:"author"`
	CreatedAt int    `json:"createdAt"`
	UpdatedAt int    `json:"updatedAt"`
	Updater   string `json:"updater"`
	Active    bool   `json:"active"`
	DeletedAt int    `json:"deletedAt"`
}

Meta contains metadata

type MsHashField

type MsHashField struct {
	Field string `json:"field"`
	Value string `json:"value"`
}

type NotificationContent

type NotificationContent struct {
	Id      string          `json:"_id"`
	Meta    *Meta           `json:"_meta"`
	Content json.RawMessage `json:"_source"`
	Count   int             `json:"count"`
}

NotificationContent contains

type NotificationResult

type NotificationResult struct {
	RequestId  string               `json:"requestId"`
	Result     *NotificationContent `json:"result"`
	Volatile   json.RawMessage      `json:"volatile"`
	Index      string               `json:"index"`
	Collection string               `json:"collection"`
	Controller string               `json:"controller"`
	Action     string               `json:"action"`
	Protocol   string               `json:"protocol"`
	Scope      string               `json:"scope"`
	State      string               `json:"state"`
	User       string               `json:"user"`
	Type       string               `json:"type"`
	RoomId     string               `json:"room"`
	Channel    string               `json:"channel"`
	Timestamp  int                  `json:"timestamp"`
	Status     int                  `json:"status"`
	Error      KuzzleError          `json:"error"`
}

NotificationResult is a notification from Kuzzle

type Options

type Options interface {
	QueueTTL() time.Duration
	SetQueueTTL(time.Duration) *options
	QueueMaxSize() int
	SetQueueMaxSize(int) *options
	OfflineMode() int
	SetOfflineMode(int) *options
	AutoQueue() bool
	SetAutoQueue(bool) *options
	AutoReconnect() bool
	SetAutoReconnect(bool) *options
	AutoReplay() bool
	SetAutoReplay(bool) *options
	AutoResubscribe() bool
	SetAutoResubscribe(bool) *options
	ReconnectionDelay() time.Duration
	SetReconnectionDelay(time.Duration) *options
	ReplayInterval() time.Duration
	SetReplayInterval(time.Duration) *options
	Port() int
	SetPort(int) *options
	SslConnection() bool
	SetSslConnection(bool) *options
	Headers() *http.Header
	SetHeaders(*http.Header) *options
}

Options provides a public access to options private struct

type Policies

type Policies struct {
	Policies []*Policy `json:"policies"`
}

type Policy

type Policy struct {
	RoleId       string               `json:"roleId"`
	RestrictedTo []*PolicyRestriction `json:"restrictedTo,omitempty"`
}

type PolicyRestriction

type PolicyRestriction struct {
	Index       string   `json:"index"`
	Collections []string `json:"collections,omitempty"`
}

type QueryObject

type QueryObject struct {
	Query     []byte
	Options   QueryOptions
	ResChan   chan<- *KuzzleResponse
	NotifChan chan<- *NotificationResult
	Timestamp time.Time
	RequestId string
}

QueryObject contains items to perform queries

type QueryOptions

type QueryOptions interface {
	Queuable() bool
	SetQueuable(bool) *queryOptions
	From() int
	SetFrom(int) *queryOptions
	Size() int
	SetSize(int) *queryOptions
	Scroll() string
	SetScroll(string) *queryOptions
	ScrollId() string
	SetScrollId(string) *queryOptions
	Volatile() VolatileData
	SetVolatile(VolatileData) *queryOptions
	Refresh() string
	SetRefresh(string) *queryOptions
	IfExist() string
	SetIfExist(string) *queryOptions
	IncludeTrash() bool
	SetIncludeTrash(bool) *queryOptions
	RetryOnConflict() int
	SetRetryOnConflict(int) *queryOptions
	Start() int
	SetStart(int) *queryOptions
	End() int
	SetEnd(int) *queryOptions
	Count() int
	SetCount(int) *queryOptions
	Sort() string
	SetSort(string) *queryOptions
	Match() string
	SetMatch(string) *queryOptions
	Ch() bool
	SetCh(bool) *queryOptions
	Incr() bool
	SetIncr(bool) *queryOptions
	Nx() bool
	SetNx(bool) *queryOptions
	Xx() bool
	SetXx(bool) *queryOptions
	Ex() int
	SetEx(int) *queryOptions
	Px() int
	SetPx(int) *queryOptions
	Limit() []int
	SetLimit([]int) *queryOptions
	Aggregate() string
	SetAggregate(string) *queryOptions
	Weights() []int
	SetWeights([]int) *queryOptions
	Type() string
	SetType(string) *queryOptions
	By() string
	SetBy(string) *queryOptions
	Direction() string
	SetDirection(string) *queryOptions
	Get() []string
	SetGet([]string) *queryOptions
	Alpha() bool
	SetAlpha(bool) *queryOptions
	Unit() string
	SetUnit(string) *queryOptions
	Withdist() bool
	SetWithdist(bool) *queryOptions
	Withcoord() bool
	SetWithcoord(bool) *queryOptions
	Reset() bool
	ID() string
}

QueryOptions provides a public access to queryOptions private struct

type RealtimeResponse

type RealtimeResponse struct {
	Published bool `json:"published"`
}

type RoomList

type RoomList = sync.Map

type RoomOptions

type RoomOptions interface {
	Scope() string
	SetScope(string) *roomOptions
	State() string
	SetState(string) *roomOptions
	Users() string
	SetUsers(string) *roomOptions
	SubscribeToSelf() bool
	SetSubscribeToSelf(bool) *roomOptions
	Volatile() VolatileData
	SetVolatile(VolatileData) *roomOptions
	AutoResubscribe() bool
	SetAutoResubscribe(bool)
}

RoomOptions provides a public access to roomOptions private struct

func NewRoomOptions

func NewRoomOptions() RoomOptions

NewRoomOptions instanciates a new RoomOptions

type SearchFilters

type SearchFilters struct {
	Query        json.RawMessage `json:"query,omitempty"`
	Sort         json.RawMessage `json:"sort,omitempty"`
	Aggregations json.RawMessage `json:"aggregations,omitempty"`
	SearchAfter  json.RawMessage `json:"search_after,omitempty"`
}

type SearchResult

type SearchResult struct {
	Aggregations json.RawMessage
	Hits         json.RawMessage
	Total        int
	Fetched      int
	ScrollId     string
	// contains filtered or unexported fields
}

SearchResult is a search result representation

func NewSearchResult

func NewSearchResult(kuzzle IKuzzle, scrollAction string, request *KuzzleRequest, options QueryOptions, raw *KuzzleResponse) (*SearchResult, error)

NewSearchResult Search Result constructor

func (*SearchResult) Kuzzle

func (sr *SearchResult) Kuzzle() IKuzzle

func (*SearchResult) Next

func (sr *SearchResult) Next() (*SearchResult, error)

Next page result

func (*SearchResult) Options

func (sr *SearchResult) Options() QueryOptions

func (*SearchResult) Request

func (sr *SearchResult) Request() *KuzzleRequest

func (*SearchResult) Response

func (sr *SearchResult) Response() *KuzzleResponse

func (*SearchResult) ScrollAction

func (sr *SearchResult) ScrollAction() string

type ShardResponse

type ShardResponse struct {
	Found   bool    `json:"found"`
	Index   string  `json:"_index"`
	Type    string  `json:"_type"`
	Id      string  `json:"_id"`
	Version int     `json:"_version"`
	Result  string  `json:"result"`
	Shards  *Shards `json:"_shards"`
}

type Shards

type Shards struct {
	Total      int `json:"total"`
	Successful int `json:"successful"`
	Failed     int `json:"failed"`
}

type Specification

type Specification struct {
	Strict     bool                `json:"strict,omitempty"`
	Fields     SpecificationFields `json:"fields,omitempty"`
	Validators json.RawMessage     `json:"validators,omitempty"`
}

type SpecificationEntry

type SpecificationEntry struct {
	Validation *Specification `json:"validation"`
	Index      string         `json:"index"`
	Collection string         `json:"collection"`
}

type SpecificationField

type SpecificationField struct {
	Type        string `json:"type,omitempty"`
	Depth       int    `json:"depth,omitempty"`
	Mandatory   bool   `json:"mandatory,omitempty"`
	Description string `json:"description,omitempty"`
	Multivalued struct {
		Value    bool `json:"value,omitempty"`
		MinCount int  `json:"minCount,omitempty"`
		MaxCount int  `json:"maxCount,omitempty"`
	} `json:"multivalued,omitempty"`
	DefaultValue interface{} `json:"defaultValue,omitempty"`
	TypeOptions  struct {
		Range struct {
			Min interface{} `json:"min,omitempty"`
			Max interface{} `json:"max,omitempty"`
		} `json:"range,omitempty"`
		Length struct {
			Min int         `json:"min,omitempty"`
			Max interface{} `json:"max,omitempty"`
		} `json:"length"`
		NotEmpty   bool     `json:"notEmpty,omitempty"`
		Formats    []string `json:"formats,omitempty"`
		Strict     bool     `json:"strict,omitempty"`
		Values     []string `json:"values,omitempty"`
		ShapeTypes []string `json:"shapeTypes,omitempty"`
	} `json:"typeOptions,omitempty"`
}

type SpecificationFields

type SpecificationFields map[string]SpecificationField

type SpecificationSearchResult

type SpecificationSearchResult struct {
	Hits     []SpecificationSearchResultHit `json:"hits"`
	Total    int                            `json:"total"`
	ScrollId string                         `json:"scrollId"`
}

type SpecificationSearchResultHit

type SpecificationSearchResultHit struct {
	Source SpecificationEntry `json:"_source"`
}

type Statistics

type Statistics struct {
	CompletedRequests json.RawMessage `json:"completedRequests"`
	Connections       json.RawMessage `json:"connections"`
	FailedRequests    json.RawMessage `json:"failedRequests"`
	OngoingRequests   json.RawMessage `json:"ongoingRequests"`
	Timestamp         int             `json:"timestamp"`
}

type SubscribeQuery

type SubscribeQuery struct {
	Scope string      `json:"scope"`
	State string      `json:"state"`
	User  string      `json:"user"`
	Body  interface{} `json:"body"`
}

type SubscribeResponse

type SubscribeResponse struct {
	Room  IRoom
	Error error
}

SubscribeResponse is a response given after a new subscriptions

type SubscribeResult

type SubscribeResult struct {
	Room    string `json:"roomId"`
	Channel string `json:"channel"`
}

type UserData

type UserData struct {
	ProfileIds []string               `json:"profileIds"`
	Content    map[string]interface{} `json:"content"`
}

type UserRights

type UserRights struct {
	Controller string `json:"controller"`
	Action     string `json:"action"`
	Index      string `json:"index"`
	Collection string `json:"collection"`
	Value      string `json:"value"`
}

type ValidResponse

type ValidResponse struct {
	Valid bool `json:"valid"`
}

type ValidationResponse

type ValidationResponse struct {
	Valid       bool     `json:"valid"`
	Details     []string `json:"details"`
	Description string   `json:"description"`
}

ValidationResponse contains a validation response

func NewValidationResponse

func NewValidationResponse(validationResponse json.RawMessage) (*ValidationResponse, error)

type VolatileData

type VolatileData = json.RawMessage

Jump to

Keyboard shortcuts

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