Documentation
¶
Index ¶
- type Client
- type Collection
- func (c *Collection) Delete(ctx context.Context, id string) error
- func (c *Collection) Get(ctx context.Context, id string) (map[string]interface{}, error)
- func (c *Collection) Insert(ctx context.Context, data map[string]interface{}) (string, error)
- func (c *Collection) Query(ctx context.Context, filter map[string]interface{}, ...) ([]map[string]interface{}, error)
- func (c *Collection) Update(ctx context.Context, id string, data map[string]interface{}) error
- type Option
- type Transaction
- type TransactionCollection
- func (c *TransactionCollection) Delete(ctx context.Context, id string) error
- func (c *TransactionCollection) Get(ctx context.Context, id string) (map[string]interface{}, error)
- func (c *TransactionCollection) Insert(ctx context.Context, data map[string]interface{}) (string, error)
- func (c *TransactionCollection) Query(ctx context.Context, filter map[string]interface{}, ...) ([]map[string]interface{}, error)
- func (c *TransactionCollection) Update(ctx context.Context, id string, data map[string]interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the DataStore interface for PostgreSQL
func (*Client) Collection ¶
func (c *Client) Collection(name string) interfaces.CollectionRef
Collection returns a reference to a specific collection/table
func (*Client) Transaction ¶
func (c *Client) Transaction(ctx context.Context, fn func(tx interfaces.Transaction) error) error
Transaction executes multiple operations in a transaction
type Collection ¶
type Collection struct {
// contains filtered or unexported fields
}
Collection represents a reference to a collection/table
func (*Collection) Delete ¶
func (c *Collection) Delete(ctx context.Context, id string) error
Delete deletes a document by ID
func (*Collection) Query ¶
func (c *Collection) Query(ctx context.Context, filter map[string]interface{}, options ...interfaces.QueryOption) ([]map[string]interface{}, error)
Query queries documents in the collection
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction represents a database transaction
func (*Transaction) Collection ¶
func (t *Transaction) Collection(name string) interfaces.CollectionRef
Collection returns a reference to a specific collection/table within the transaction
func (*Transaction) Rollback ¶
func (t *Transaction) Rollback() error
Rollback rolls back the transaction
type TransactionCollection ¶
type TransactionCollection struct {
// contains filtered or unexported fields
}
TransactionCollection represents a collection within a transaction
func (*TransactionCollection) Delete ¶
func (c *TransactionCollection) Delete(ctx context.Context, id string) error
Delete deletes a document by ID within a transaction
func (*TransactionCollection) Insert ¶
func (c *TransactionCollection) Insert(ctx context.Context, data map[string]interface{}) (string, error)
Insert inserts a document into the collection within a transaction
func (*TransactionCollection) Query ¶
func (c *TransactionCollection) Query(ctx context.Context, filter map[string]interface{}, options ...interfaces.QueryOption) ([]map[string]interface{}, error)
Query queries documents in the collection within a transaction