Documentation
¶
Index ¶
- type Client
- func (c *Client) Begin() (*Tx, error)
- func (c *Client) Close() error
- func (c *Client) CollectionCreate(name string) (*CommandResponse, error)
- func (c *Client) CollectionDelete(name string) (*CommandResponse, error)
- func (c *Client) CollectionIndexCreate(collectionName, fieldName string) (*CommandResponse, error)
- func (c *Client) CollectionIndexDelete(collectionName, fieldName string) (*CommandResponse, error)
- func (c *Client) CollectionIndexList(collectionName string) ([]string, error)
- func (c *Client) CollectionItemDelete(collectionName, key string) (*CommandResponse, error)
- func (c *Client) CollectionItemDeleteMany(collectionName string, keys []string) (*CommandResponse, error)
- func (c *Client) CollectionItemGet(collectionName, key string) (*GetResult, error)
- func (c *Client) CollectionItemSet(collectionName, key string, value any, ttl time.Duration) (*CommandResponse, error)
- func (c *Client) CollectionItemSetMany(collectionName string, items []any) (*CommandResponse, error)
- func (c *Client) CollectionItemUpdate(collectionName, key string, patchValue any) (*CommandResponse, error)
- func (c *Client) CollectionItemUpdateMany(collectionName string, items []any) (*CommandResponse, error)
- func (c *Client) CollectionList() ([]string, error)
- func (c *Client) CollectionQuery(collectionName string, query Query) (*CommandResponse, error)
- func (c *Client) Connect() error
- func (c *Client) IsAuthenticated() bool
- type ClientOptions
- type CommandResponse
- type GetResult
- type Query
- type Tx
- func (t *Tx) CollectionItemDelete(collectionName, key string) (*CommandResponse, error)
- func (t *Tx) CollectionItemDeleteMany(collectionName string, keys []string) (*CommandResponse, error)
- func (t *Tx) CollectionItemSet(collectionName, key string, value any, ttl time.Duration) (*CommandResponse, error)
- func (t *Tx) CollectionItemSetMany(collectionName string, items []any) (*CommandResponse, error)
- func (t *Tx) CollectionItemUpdate(collectionName, key string, patchValue any) (*CommandResponse, error)
- func (t *Tx) CollectionItemUpdateMany(collectionName string, items []any) (*CommandResponse, error)
- func (t *Tx) Commit() (*CommandResponse, error)
- func (t *Tx) Rollback() (*CommandResponse, 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
}
func NewClient ¶
func NewClient(opts ClientOptions) *Client
func (*Client) CollectionCreate ¶
func (c *Client) CollectionCreate(name string) (*CommandResponse, error)
func (*Client) CollectionDelete ¶
func (c *Client) CollectionDelete(name string) (*CommandResponse, error)
func (*Client) CollectionIndexCreate ¶
func (c *Client) CollectionIndexCreate(collectionName, fieldName string) (*CommandResponse, error)
func (*Client) CollectionIndexDelete ¶
func (c *Client) CollectionIndexDelete(collectionName, fieldName string) (*CommandResponse, error)
func (*Client) CollectionIndexList ¶
func (*Client) CollectionItemDelete ¶
func (c *Client) CollectionItemDelete(collectionName, key string) (*CommandResponse, error)
func (*Client) CollectionItemDeleteMany ¶
func (c *Client) CollectionItemDeleteMany(collectionName string, keys []string) (*CommandResponse, error)
func (*Client) CollectionItemGet ¶
func (*Client) CollectionItemSet ¶
func (*Client) CollectionItemSetMany ¶
func (c *Client) CollectionItemSetMany(collectionName string, items []any) (*CommandResponse, error)
func (*Client) CollectionItemUpdate ¶
func (c *Client) CollectionItemUpdate(collectionName, key string, patchValue any) (*CommandResponse, error)
func (*Client) CollectionItemUpdateMany ¶
func (c *Client) CollectionItemUpdateMany(collectionName string, items []any) (*CommandResponse, error)
func (*Client) CollectionList ¶
func (*Client) CollectionQuery ¶
func (c *Client) CollectionQuery(collectionName string, query Query) (*CommandResponse, error)
func (*Client) IsAuthenticated ¶
type ClientOptions ¶
type CommandResponse ¶
func (*CommandResponse) BSON ¶ added in v1.0.7
func (r *CommandResponse) BSON(v any) error
func (*CommandResponse) OK ¶
func (r *CommandResponse) OK() bool
func (*CommandResponse) UnmarshalResults ¶ added in v1.0.7
func (r *CommandResponse) UnmarshalResults(v any) error
type GetResult ¶
type GetResult struct {
*CommandResponse
}
type Query ¶
type Query struct {
Filter map[string]any `bson:"filter,omitempty"`
OrderBy []any `bson:"order_by,omitempty"`
Limit *int `bson:"limit,omitempty"`
Offset int `bson:"offset,omitempty"`
Count bool `bson:"count,omitempty"`
Aggregations map[string]any `bson:"aggregations,omitempty"`
GroupBy []string `bson:"group_by,omitempty"`
Having map[string]any `bson:"having,omitempty"`
Distinct string `bson:"distinct,omitempty"`
Projection []string `bson:"projection,omitempty"`
Lookups []any `bson:"lookups,omitempty"`
}
type Tx ¶ added in v1.0.9
type Tx struct {
// contains filtered or unexported fields
}
Tx representa una transacción activa amarrada a una única conexión de red.
func (*Tx) CollectionItemDelete ¶ added in v1.0.9
func (t *Tx) CollectionItemDelete(collectionName, key string) (*CommandResponse, error)
func (*Tx) CollectionItemDeleteMany ¶ added in v1.0.9
func (t *Tx) CollectionItemDeleteMany(collectionName string, keys []string) (*CommandResponse, error)
func (*Tx) CollectionItemSet ¶ added in v1.0.9
func (t *Tx) CollectionItemSet(collectionName, key string, value any, ttl time.Duration) (*CommandResponse, error)
Métodos de mutación exclusivos de la transacción (Amarrados al Tx)
func (*Tx) CollectionItemSetMany ¶ added in v1.0.9
func (t *Tx) CollectionItemSetMany(collectionName string, items []any) (*CommandResponse, error)
func (*Tx) CollectionItemUpdate ¶ added in v1.0.9
func (t *Tx) CollectionItemUpdate(collectionName, key string, patchValue any) (*CommandResponse, error)
func (*Tx) CollectionItemUpdateMany ¶ added in v1.0.9
func (t *Tx) CollectionItemUpdateMany(collectionName string, items []any) (*CommandResponse, error)
func (*Tx) Commit ¶ added in v1.0.9
func (t *Tx) Commit() (*CommandResponse, error)
Commit finaliza la transacción y devuelve la conexión al pool.
func (*Tx) Rollback ¶ added in v1.0.9
func (t *Tx) Rollback() (*CommandResponse, error)
Rollback revierte la transacción y devuelve la conexión al pool.
Click to show internal directories.
Click to hide internal directories.