Documentation
¶
Index ¶
- Constants
- type AggregateRequest
- type AllRequest
- type BatchRequest
- type ColStore
- type CreateRequest
- type DbStore
- type DeleteRequest
- type DocumentSnapshot
- type FunctionsPayload
- type IdStore
- type LiveQueryOptions
- type M
- type Meta
- type PreparedQueryRequest
- type ProfileParams
- type ReadOptions
- type ReadRequest
- type RealtimeParams
- type RealtimeRequest
- type Response
- type ServiceRequest
- type SnapshotData
- type Storage
- type Store
- type SubscriptionEvent
- type SubscriptionObject
- type UpdateRequest
- type WebsocketMessage
Constants ¶
const ( // All is used when all the records needs to be worked on All string = "all" // One is used when oly a single record needs to be worked on One string = "one" // Read is used to Read documents Read string = "read" Aggregate string = "aggr" // Upsert is used to upsert documents Batch string = "batch" // Count is used to count the number of documents returned Count string = "count" // Distinct is used to get the distinct values Distinct string = "distinct" // Upsert is used to upsert documents Upsert string = "upsert" // Delete is used to delete documents Delete string = "delete" // Update is used to update documents Update string = "update" // Create is used to create documents Create string = "create" // PreparedQueries is used execute a particular Prepared Query PreparedQueries string = "prepared-queries" )
const ( // TypeRealtimeSubscribe is the request type for live query subscription TypeRealtimeSubscribe string = "realtime-subscribe" // TypeRealtimeUnsubscribe is the request type for live query subscription TypeRealtimeUnsubscribe string = "realtime-unsubscribe" // TypeRealtimeFeed is the response type for realtime feed TypeRealtimeFeed string = "realtime-feed" )
const ( // RealtimeInsert is for create operations RealtimeInsert string = "insert" // RealtimeUpdate is for update operations RealtimeUpdate string = "update" // RealtimeDelete is for delete operations RealtimeDelete string = "delete" // RealtimeInitial is for initial operations RealtimeInitial string = "initial" )
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 interface{} `json:"find"`
Update interface{} `json:"update"`
Type string `json:"type"`
}
AllRequest is a union of parameters required in the various requests
type BatchRequest ¶
type BatchRequest struct {
Requests []AllRequest `json:"reqs"`
}
BatchRequest is the http body for a batch request
type CreateRequest ¶
type CreateRequest struct {
Document interface{} `json:"doc"`
Operation string `json:"op"`
}
CreateRequest is the http body received for a create request
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 DocumentSnapshot ¶
type DocumentSnapshot struct {
// contains filtered or unexported fields
}
DocumentSnapshot contains the data and meta info of a single document
func (*DocumentSnapshot) Unmarshal ¶
func (s *DocumentSnapshot) Unmarshal(vPtr interface{}) error
Unmarshal parses the document and stores the value into vPtr
type FunctionsPayload ¶
type FunctionsPayload struct {
ID string `json:"id"`
Auth map[string]interface{} `json:"auth"`
Params interface{} `json:"params"`
Service string `json:"service"`
Func string `json:"func"`
Error string `json:"error"`
}
FunctionsPayload is the struct transmitted via the broker
type LiveQueryOptions ¶
LiveQueryOptions is used to set the options for the live query
type M ¶
type M map[string]interface{}
M is a type representing a map
func GenerateFind ¶
GenerateFind generates a Mongo db find clause from the provided condition
type PreparedQueryRequest ¶ added in v0.18.0
type PreparedQueryRequest struct {
Params map[string]interface{} `json:"params"`
}
PreparedQueryRequest is the http body received for a PreparedQuery request
type ProfileParams ¶
A struct to hold the new values for EditProfile
type ReadOptions ¶
type ReadOptions struct {
Select map[string]int32 `json:"select"`
Sort []string `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 {
GroupBy []interface{} `json:"group"`
Aggregate map[string][]string `json:"aggregate"`
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 RealtimeParams ¶
type RealtimeParams struct {
Find M
}
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 Response ¶
Response is the object recieved from the server. Status is the status code received from the server. Data is either a map[string]interface{} or
type ServiceRequest ¶
type ServiceRequest struct {
Params interface{} `json:"params"`
Timeout int `json:"timeout"`
}
ServiceRequest is the api call request
type SnapshotData ¶
type Store ¶
type Store struct {
QueryOptions LiveQueryOptions
Snapshot []*SnapshotData
C chan *SubscriptionEvent
Find interface{}
Options interface{}
Unsubscribe func()
}
type SubscriptionEvent ¶
type SubscriptionEvent struct {
// contains filtered or unexported fields
}
func NewSubscriptionEvent ¶
func NewSubscriptionEvent(evType string, doc interface{}, find map[string]interface{}, err error) *SubscriptionEvent
func (*SubscriptionEvent) Err ¶
func (s *SubscriptionEvent) Err() error
func (*SubscriptionEvent) Find ¶
func (s *SubscriptionEvent) Find() map[string]interface{}
func (*SubscriptionEvent) Type ¶
func (s *SubscriptionEvent) Type() string
func (*SubscriptionEvent) Unmarshal ¶
func (s *SubscriptionEvent) Unmarshal(vPtr interface{}) error
type SubscriptionObject ¶
type SubscriptionObject struct {
// contains filtered or unexported fields
}
func LiveQuerySubscriptionInit ¶
func LiveQuerySubscriptionInit(store *Store) *SubscriptionObject
func (*SubscriptionObject) C ¶
func (s *SubscriptionObject) C() chan *SubscriptionEvent
func (*SubscriptionObject) GetSnapshot ¶
func (s *SubscriptionObject) GetSnapshot() []DocumentSnapshot
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
type WebsocketMessage ¶
type WebsocketMessage struct {
Type string `json:"type"`
Data interface{} `json:"data"`
ID string `json:"id"` // the request id
}
WebsocketMessage is the body for a websocket request