Documentation
¶
Overview ¶
Package entity is a connector to execute CRUD commands for a single entity and many entities on a DB instance.
A note on querying limitations:
This package uses the Kubernetes Labels Selector syntax (KLS) for its query language. There are some querying limitations with using KLS which is explained below: Querying many entities: there are some limitations. Because of limitations in KLS, a caller can only query by field names that are alphanumeric characters, '-', '_' or '.', and that start and end with an alphanumeric character. The limitations also extend to operators and values. Less than and greater than operators will interpret their values as an integer. All other operators will interpret their values as a string. For example, caller cannot query for all documents that have field name "x" with value 2. Creating entities: there are no limitations. CreateEntities will allow you to create any entity that's a map of a string to interface{}. However, given the query limitations explained above, if you expect to be able to query for a field/value, ensure you only create an entity that would then satisfy a query.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotFound = errors.New("entity not found")
)
Functions ¶
This section is empty.
Types ¶
type ErrCreate ¶
ErrCreate is a higher level error for caller to check against when calling CreateEntities. It holds the lower level error message from DB and the number of entities successfully inserted on create.
type ErrDelete ¶
type ErrDelete struct {
DbError error
}
ErrDelete is a higher level error for caller to check against when calling DeleteEntities. It holds the lower level error message from DB.
type ErrDeleteLabel ¶
type ErrDeleteLabel struct {
DbError error
}
ErrDeleteLabel is a higher level error for caller to check against when calling DeleteLabel. It holds the lower level error message from DB.
func (ErrDeleteLabel) Error ¶
func (e ErrDeleteLabel) Error() string
type ErrRead ¶
type ErrRead struct {
DbError error
}
ErrRead is a higher level error for caller to check against when calling ReadEntities. It holds the lower level error message from DB.
type ErrUpdate ¶
type ErrUpdate struct {
DbError error
}
ErrUpdate is a higher level error for caller to check against when calling UpdateEntities. It holds the lower level error message from DB.
type Store ¶
type Store interface { // Managing labels for a single entity DeleteLabel(WriteOp, string) (etre.Entity, error) // Managing multiple entities ReadEntities(string, query.Query, etre.QueryFilter) ([]etre.Entity, error) CreateEntities(WriteOp, []etre.Entity) ([]string, error) UpdateEntities(WriteOp, query.Query, etre.Entity) ([]etre.Entity, error) DeleteEntities(WriteOp, query.Query) ([]etre.Entity, error) }
Store interface has methods needed to do CRUD operations on entities.
type WriteOp ¶
type WriteOp struct { User string // required EntityType string // required EntityId string // optional // Delete ops do not support set ops like insert and update because no // entities are sent by the client on delete. However, the caller can do // DELETE /entity/node?setOp=foo&setId=bar&setSize=2 and the controller // will pass along the set op values. This could (but not currently) also // be used to impose/inject a set op on a write op that doesn't specify // a set op. SetOp string // optional SetId string // optional SetSize int // optional }
WriteOp represents common metadata for insert, update, and delete Store methods.