model

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2019 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregateRequest

type AggregateRequest struct {
	Pipeline  interface{} `json:"pipe"`
	Operation string      `json:"op"`
}

AggregateRequest is the http body received for an aggregate request

type AllRequest

type AllRequest struct {
	Col       string                 `json:"col"`
	Document  interface{}            `json:"doc"`
	Operation string                 `json:"op"`
	Find      map[string]interface{} `json:"find"`
	Update    map[string]interface{} `json:"update"`
	Type      string                 `json:"type"`
}

AllRequest is a union of parameters required in the various requests

type BatchIntentHook added in v0.12.0

type BatchIntentHook func(ctx context.Context, dbType string, req *BatchRequest) (*EventIntent, error)

BatchIntentHook is used to log a create intent

type BatchRequest

type BatchRequest struct {
	Requests []AllRequest `json:"reqs"`
}

BatchRequest is the http body for a batch request

type CloudEventPayload added in v0.13.0

type CloudEventPayload struct {
	SpecVersion string      `json:"specversion"`
	Type        string      `json:"type"`
	Source      string      `json:"source"`
	Id          string      `json:"id"`
	Time        string      `json:"time"`
	Data        interface{} `json:"data"`
}

CloudEventPayload is the the JSON event spec by Cloud Events Specification

type CreateFileRequest

type CreateFileRequest struct {
	Path    string `json:"path"`
	Name    string `json:"name"`
	Type    string `json:"type"`    // Either file or dir
	MakeAll bool   `json:"makeAll"` // This option is only available for creating directories
}

CreateFileRequest is the request received to create a new file or directory

type CreateIntentHook added in v0.12.0

type CreateIntentHook func(ctx context.Context, dbType, col string, req *CreateRequest) (*EventIntent, error)

CreateIntentHook is used to log a create intent

type CreateRequest

type CreateRequest struct {
	Document  interface{} `json:"doc"`
	Operation string      `json:"op"`
}

CreateRequest is the http body received for a create request

type CrudHooks added in v0.12.0

type CrudHooks struct {
	Create CreateIntentHook
	Update UpdateIntentHook
	Delete DeleteIntentHook
	Batch  BatchIntentHook
	Stage  StageEventHook
}

CrudHooks is the struct to store the hooks related to the crud module

type DatabaseEventMessage added in v0.12.0

type DatabaseEventMessage struct {
	DBType string      `json:"db" mapstructure:"db"`
	Col    string      `json:"col" mapstructure:"col"`
	DocID  string      `json:"docId" mapstructure:"docId"`
	Doc    interface{} `json:"doc" mapstructure:"doc"`
}

DatabaseEventMessage is the event payload for create, update and delete events

type DeleteIntentHook added in v0.12.0

type DeleteIntentHook func(ctx context.Context, dbType, col string, req *DeleteRequest) (*EventIntent, error)

DeleteIntentHook is used to log a create intent

type DeleteRequest

type DeleteRequest struct {
	Find      map[string]interface{} `json:"find"`
	Operation string                 `json:"op"`
}

DeleteRequest is the http body received for a delete request

type EventDocument added in v0.12.0

type EventDocument struct {
	ID             string      `structs:"_id" json:"_id" bson:"_id" mapstructure:"_id"`
	BatchID        string      `structs:"batchid" json:"batchid" bson:"batchid" mapstructure:"batchid"`
	Type           string      `structs:"type" json:"type" bson:"type" mapstructure:"type"`
	Token          int         `structs:"token" json:"token" bson:"token" mapstructure:"token"`
	Timestamp      int64       `structs:"timestamp" json:"timestamp" bson:"timestamp" mapstructure:"timestamp"`                         // The timestamp of when the event should get executed
	EventTimestamp int64       `structs:"event_timestamp" json:"event_timestamp" bson:"event_timestamp" mapstructure:"event_timestamp"` // The time stamp of when the event was logged
	Payload        interface{} `structs:"payload" json:"payload" bson:"payload" mapstructure:"payload"`
	Status         string      `structs:"status" json:"status" bson:"status" mapstructure:"status"`
	Retries        int         `structs:"retries" json:"retries" bson:"retries" mapstructure:"retries"`
	Url            string      `structs:"url" json:"url" bson:"url" mapstructure:"url"`
	Remark         string      `structs:"remark" json:"remark" bson:"remark" mapstructure:"remark"`
}

EventDocument is the format in which the event is persistent on disk

type EventIntent added in v0.12.0

type EventIntent struct {
	BatchID string
	Token   int
	Docs    []*EventDocument
	Invalid bool
}

EventIntent describes an intent made in the eventing system

type EventKind added in v0.12.0

type EventKind string

EventKind is the type describing the kind of event

type EventResponse added in v0.13.0

type EventResponse struct {
	Event  *QueueEventRequest   `json:"event"`
	Events []*QueueEventRequest `json:"events"`
	Error  string               `json:"error"`
}

type FeedData

type FeedData struct {
	QueryID   string      `json:"id" structs:"id"`
	DocID     string      `json:"docId" structs:"docId"`
	Type      string      `json:"type" structs:"type"`
	Payload   interface{} `json:"payload" structs:"payload"`
	TimeStamp int64       `json:"time" structs:"time"`
	Group     string      `json:"group" structs:"group"`
	DBType    string      `json:"dbType" structs:"dbType"`
	TypeName  string      `json:"__typename,omitempty" structs:"__typename,omitempty"`
}

FeedData is the format to send realtime data

type File

type File struct {
	File  io.Reader
	Close func() error
}

File is the struct returned for file reads

type FileReader

type FileReader func(io.Reader) (int, error)

FileReader is a function type used for file streaming

type FunctionsRequest

type FunctionsRequest struct {
	Params  interface{} `json:"params"`
	Timeout int         `json:"timeout"`
}

FunctionsRequest is the api call request

type GraphQLRequest added in v0.12.0

type GraphQLRequest struct {
	Query         string                 `json:"query"`
	OperationName string                 `json:"operationName"`
	Variables     map[string]interface{} `json:"variables"`
}

GraphQLRequest is the payload received in a graphql request

type ListFilesRequest

type ListFilesRequest struct {
	Path string `json:"path"`
	Type string `json:"type"` // Type could be dir, file or all
}

ListFilesRequest is the request made to browse the contents inside a directory

type ListFilesResponse

type ListFilesResponse struct {
	Name string `json:"name"`
	Type string `json:"type"` // Type could be dir or file
}

ListFilesResponse is the response given to browse the contents inside a directory

type LiveQueryOptions added in v0.10.0

type LiveQueryOptions struct {
	SkipInitial bool `json:"skipInitial"`
}

LiveQueryOptions is to set the options for realtime requests

type Message

type Message struct {
	Type string      `json:"type"`
	Data interface{} `json:"data"`
	ID   string      `json:"id"` // the request id
}

Message is the request body of the message

type MetricCrudHook added in v0.13.0

type MetricCrudHook func(project, dbType, col string, count int64, op utils.OperationType)

MetricCrudHook is used to log a database operation

type QueueEventRequest added in v0.12.0

type QueueEventRequest struct {
	Type      string            `json:"type"`                // The type of the event
	Delay     int64             `json:"delay,omitempty"`     // Time in seconds
	Timestamp int64             `json:"timestamp,omitempty"` // Milliseconds from unix epoch (UTC)
	Payload   interface{}       `json:"payload,omitempty"`   // Payload contains necessary event dat
	Options   map[string]string `json:"options"`
}

QueueEventRequest is the payload to add a new event to the task queue

type ReadOptions

type ReadOptions struct {
	Select   map[string]int32 `json:"select"`
	Sort     map[string]int32 `json:"sort"`
	Skip     *int64           `json:"skip"`
	Limit    *int64           `json:"limit"`
	Distinct *string          `json:"distinct"`
}

ReadOptions is the options required for a read request

type ReadRequest

type ReadRequest struct {
	Find      map[string]interface{} `json:"find"`
	Operation string                 `json:"op"`
	Options   *ReadOptions           `json:"options"`
}

ReadRequest is the http body received for a read request

type ReadRequestKey added in v0.12.0

type ReadRequestKey struct {
	DBType     string
	Col        string
	HasOptions bool
	Req        ReadRequest
}

ReadRequestKey is the key type for the dataloader

func (ReadRequestKey) Raw added in v0.12.0

func (key ReadRequestKey) Raw() interface{}

Raw returns the raw, underlaying value of the key

func (ReadRequestKey) String added in v0.12.0

func (key ReadRequestKey) String() string

String returns a guaranteed unique string that can be used to identify an object

type RealtimeRequest

type RealtimeRequest struct {
	Token   string                 `json:"token"`
	DBType  string                 `json:"dbType"`
	Project string                 `json:"project"`
	Group   string                 `json:"group"` // Group is the collection name
	Type    string                 `json:"type"`  // Can either be subscribe or unsubscribe
	ID      string                 `json:"id"`    // id is the query id
	Where   map[string]interface{} `json:"where"`
	Options LiveQueryOptions       `json:"options"`
}

RealtimeRequest is the object sent for realtime requests

type RealtimeResponse

type RealtimeResponse struct {
	Group string      `json:"group"` // Group is the collection name
	ID    string      `json:"id"`    // id is the query id
	Ack   bool        `json:"ack"`
	Error string      `json:"error"`
	Docs  []*FeedData `json:"docs"`
}

RealtimeResponse is the object sent for realtime requests

type StageEventHook added in v0.12.0

type StageEventHook func(ctx context.Context, intent *EventIntent, err error)

StageEventHook is used to stage an intended event

type UpdateIntentHook added in v0.12.0

type UpdateIntentHook func(ctx context.Context, dbType, col string, req *UpdateRequest) (*EventIntent, error)

UpdateIntentHook is used to log a create intent

type UpdateRequest

type UpdateRequest struct {
	Find      map[string]interface{} `json:"find"`
	Operation string                 `json:"op"`
	Update    map[string]interface{} `json:"update"`
}

UpdateRequest is the http body received for an update request

Jump to

Keyboard shortcuts

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