Documentation ¶
Index ¶
- Variables
- func ProfileExists(profile string) bool
- func SaveConfig(profile string, opts *ClientOpts) error
- func SaveDefaultConfig(opts *ClientOpts) error
- type Channel
- type Client
- func (c *Client) Delete(ctx context.Context, recordID string) error
- func (c *Client) GetClientInfo(ctx context.Context, clientID string) (*ClientInfo, error)
- func (c *Client) GetIncomingSharing(ctx context.Context) ([]IncomingSharingPolicy, error)
- func (c *Client) GetOutgoingSharing(ctx context.Context) ([]OutgoingSharingPolicy, error)
- func (c *Client) NewEventSource(ctx context.Context) (*EventSource, error)
- func (c *Client) Query(ctx context.Context, q Q) *Cursor
- func (c *Client) Read(ctx context.Context, recordID string) (*Record, error)
- func (c *Client) ReadRaw(ctx context.Context, recordID string) (*Record, error)
- func (c *Client) Share(ctx context.Context, recordType string, readerID string) error
- func (c *Client) Unshare(ctx context.Context, recordType string, readerID string) error
- func (c *Client) Update(ctx context.Context, record *Record) error
- func (c *Client) Write(ctx context.Context, recordType string, data map[string]string, ...) (*Record, error)
- type ClientInfo
- type ClientOpts
- type Cursor
- type Event
- type EventSource
- type IncomingSharingPolicy
- type Meta
- type OutgoingSharingPolicy
- type Q
- type Record
Constants ¶
This section is empty.
Variables ¶
var Done = errors.New("iteration complete")
Done is returned by Next when iteration is complete.
Functions ¶
func ProfileExists ¶
ProfileExists returns true if a configuration exists for the given profile name.
func SaveConfig ¶
func SaveConfig(profile string, opts *ClientOpts) error
SaveConfig writes an E3DB client configuration to a profile.
func SaveDefaultConfig ¶
func SaveDefaultConfig(opts *ClientOpts) error
SaveDefaultConfig writes an E3DB client configuration to a profile.
Types ¶
type Channel ¶
type Channel struct { Application string `json:"application"` Type string `json:"type"` Subject string `json:"subject"` }
Channel contains information defining the channel to which a client wishes to connect.
type Client ¶
type Client struct { Options ClientOpts // contains filtered or unexported fields }
Client is an authenticated connection to the E3DB service, providing access to end-to-end encrypted data stored in the database.
func GetClient ¶
func GetClient(opts ClientOpts) (*Client, error)
GetClient creates an E3DB client given a custom set of options. Use 'GetConfig' to load options from a configuration profile.
func GetDefaultClient ¶
GetDefaultClient loads the default E3DB configuration profile and creates a client using those options.
func (*Client) GetClientInfo ¶
GetClientInfo queries the E3DB server for a client's public information given its client UUID or email (if enabled).
func (*Client) GetIncomingSharing ¶
func (c *Client) GetIncomingSharing(ctx context.Context) ([]IncomingSharingPolicy, error)
GetIncomingSharing returns a list of writers and types of records that are currently shared with me.
func (*Client) GetOutgoingSharing ¶
func (c *Client) GetOutgoingSharing(ctx context.Context) ([]OutgoingSharingPolicy, error)
GetOutgoingSharing returns a list of readers and types of records that I am currently sharing.
func (*Client) NewEventSource ¶
func (c *Client) NewEventSource(ctx context.Context) (*EventSource, error)
NewEventSource is a factory that creates a new EventSource object for the given client, allowing for incoming events from the e3db server to be ingested by a client application.
func (*Client) Query ¶
Query executes a database query given a set of search parameters, returning a cursor that can be iterated over to loop through the result set.
func (*Client) ReadRaw ¶
ReadRaw reads a record given a record ID and returns the record without decrypting data fields.
func (*Client) Share ¶
Share grants another e3db client permission to read records of the specified record type.
func (*Client) Unshare ¶
Unshare revokes another e3db client's permission to read records of the given record type.
type ClientInfo ¶
type ClientInfo struct { ClientID string `json:"client_id"` PublicKey clientKey `json:"public_key"` Validated bool `json:"validated"` }
ClientInfo contains information sent by the E3DB service about a client.
type ClientOpts ¶
type ClientOpts struct { ClientID string ClientEmail string APIKeyID string APISecret string PublicKey publicKey PrivateKey privateKey APIBaseURL string Logging bool }
ClientOpts contains options for configuring an E3DB client.
func DefaultConfig ¶
func DefaultConfig() (*ClientOpts, error)
DefaultConfig loads the default E3DB configuration.
func GetConfig ¶
func GetConfig(profile string) (*ClientOpts, error)
GetConfig loads an E3DB client configuration from a configuration file given the name of the profile.
type Cursor ¶
type Cursor struct {
// contains filtered or unexported fields
}
Cursor represents an iterator into a recordset returned by 'e3db.Query'.
type Event ¶
type Event struct { Time time.Time `json:"time"` Application string `json:"application"` Type string `json:"type"` Action string `json:"action"` Subject string `json:"subject"` Producer string `json:"producer"` Context map[string]string `json:"context"` }
Event is an object representing the JSON blob dispatched from e3db in response to serverside events.
type EventSource ¶
type EventSource struct {
// contains filtered or unexported fields
}
EventSource represents an open socket to the e3db Event source.
func (*EventSource) Close ¶
func (c *EventSource) Close() error
Close the underlying websocket connection
func (*EventSource) Events ¶
func (c *EventSource) Events() <-chan Event
Events produces a one-way version of the event-bearing channel
func (*EventSource) Subscribe ¶
func (c *EventSource) Subscribe(channel Channel)
Subscribe to a specific event stream
func (*EventSource) Unsubscribe ¶
func (c *EventSource) Unsubscribe(channel Channel)
Unsubscribe from a specific event stream
type IncomingSharingPolicy ¶
type IncomingSharingPolicy struct { WriterID string `json:"writer_id"` Type string `json:"record_type"` WriterName string `json:"writer_name"` }
IncomingSharingPolicy contains information about who has shared what type of records with me.
type Meta ¶
type Meta struct { RecordID string `json:"record_id,omitempty"` WriterID string `json:"writer_id"` UserID string `json:"user_id"` Type string `json:"type"` Plain map[string]string `json:"plain"` Created time.Time `json:"created"` LastModified time.Time `json:"last_modified"` Version string `json:"version,omitempty"` }
Meta contains meta-information about an E3DB record, such as who wrote it, when it was written, and the type of the data stored.
type OutgoingSharingPolicy ¶
type OutgoingSharingPolicy struct { ReaderID string `json:"reader_id"` Type string `json:"record_type"` ReaderName string `json:"reader_name"` }
OutgoingSharingPolicy contains information about who and what types of records I have shared with.
type Q ¶
type Q struct { Count int `json:"count"` IncludeData bool `json:"include_data,omitempty"` WriterIDs []string `json:"writer_ids,omitempty"` UserIDs []string `json:"user_ids,omitempty"` RecordIDs []string `json:"record_ids,omitempty"` ContentTypes []string `json:"content_types,omitempty"` AfterIndex int `json:"after_index,omitempty"` Plain map[string]string `json:"plain,omitempty"` IncludeAllWriters bool `json:"include_all_writers,omitempty"` }
Q contains options for querying a set of records in the database.