Documentation ¶
Index ¶
- Constants
- Variables
- func InterfaceToArrayOfInterface(sliceOfItems interface{}) ([]interface{}, error)
- func IsPointerOFSlice(item interface{}) bool
- func Key() *key
- func Query() *query
- type DjoemoTime
- type GlobalIndex
- func (gi GlobalIndex) GetItem(key KeyInterface, item interface{}) (bool, error)
- func (gi GlobalIndex) GetItemWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error)
- func (gi GlobalIndex) GetItems(key KeyInterface, items interface{}) (bool, error)
- func (gi GlobalIndex) GetItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) (bool, error)
- func (gi GlobalIndex) Query(query QueryInterface, item interface{}) error
- func (gi GlobalIndex) QueryWithContext(ctx context.Context, query QueryInterface, item interface{}) error
- type GlobalIndexInterface
- type Iterator
- type IteratorInterface
- type KeyInterface
- type LogInterface
- type MetricsInterface
- type Model
- type ModelInterface
- type Operator
- type QueryInterface
- type Repository
- func (repository Repository) ConditionalUpdate(key KeyInterface, item interface{}, expression string, ...) (bool, error)
- func (repository Repository) ConditionalUpdateWithContext(ctx context.Context, key KeyInterface, item interface{}, expression string, ...) (bool, error)
- func (repository *Repository) ConditionalUpdateWithUpdateExpressionsAndReturnValue(ctx context.Context, key KeyInterface, item interface{}, ...) (conditionMet bool, err error)
- func (repository Repository) DeleteItem(key KeyInterface) error
- func (repository *Repository) DeleteItemWithContext(ctx context.Context, key KeyInterface) error
- func (repository Repository) DeleteItems(keys []KeyInterface) error
- func (repository *Repository) DeleteItemsWithContext(ctx context.Context, keys []KeyInterface) error
- func (repository Repository) GIndex(name string) GlobalIndexInterface
- func (repository Repository) GetItem(key KeyInterface, item interface{}) (bool, error)
- func (repository *Repository) GetItemWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error)
- func (repository Repository) GetItems(key KeyInterface, items interface{}) (bool, error)
- func (repository *Repository) GetItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) (bool, error)
- func (repository Repository) OptimisticLockSave(key KeyInterface, item interface{}) (bool, error)
- func (repository Repository) OptimisticLockSaveWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error)
- func (repository Repository) Query(query QueryInterface, item interface{}) error
- func (repository *Repository) QueryWithContext(ctx context.Context, query QueryInterface, item interface{}) error
- func (repository Repository) SaveItem(key KeyInterface, item interface{}) error
- func (repository *Repository) SaveItemWithContext(ctx context.Context, key KeyInterface, item interface{}) error
- func (repository Repository) SaveItems(key KeyInterface, items interface{}) error
- func (repository *Repository) SaveItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) error
- func (repository Repository) ScanIteratorWithContext(ctx context.Context, key KeyInterface, searchLimit int64) (IteratorInterface, error)
- func (repository Repository) Update(expression UpdateExpression, key KeyInterface, values map[string]interface{}) error
- func (repository *Repository) UpdateWithContext(ctx context.Context, expression UpdateExpression, key KeyInterface, ...) error
- func (repository *Repository) UpdateWithUpdateExpressions(ctx context.Context, key KeyInterface, updateExpressions UpdateExpressions) error
- func (repository *Repository) UpdateWithUpdateExpressionsAndReturnValue(ctx context.Context, key KeyInterface, item interface{}, ...) error
- func (repository *Repository) WithLog(log LogInterface)
- func (repository *Repository) WithMetrics(metricsInterface MetricsInterface)
- type RepositoryInterface
- type UpdateExpression
- type UpdateExpressions
Constants ¶
const ( // MetricNameSavedItemsCount save count metrics key MetricNameSavedItemsCount = "ItemsSavedCount" // MetricNameUpdatedItemsCount update count metrics key MetricNameUpdatedItemsCount = "ItemsUpdatedCount" // MetricNameDeleteItemsCount delete count metrics key MetricNameDeleteItemsCount = "ItemsDeleteCount" )
const ( Equal Operator = "EQ" NotEqual = "NE" Less = "LT" LessOrEqual = "LE" Greater = "GT" GreaterOrEqual = "GE" BeginsWith = "BEGINS_WITH" Between = "BETWEEN" )
Operators used for comparing against the range key.
const DayFormat = "2006-01-02"
DayFormat is the format for a day
const DayHourFormat = "2006-01-02 15"
DayHourFormat is the format for a day
const MonthFormat = "2006-01"
MonthFormat is the format for a month
const RFC3339Milli = "2006-01-02T15:04:05.999Z07:00"
RFC3339Milli with millisecond precision
const TableName string = "TableName"
const TenYears = time.Duration(time.Hour * 24 * 365 * 10)
TenYears ...
const TimeFormatStandard = "2006-01-02T15:04:05.000Z07:00"
TimeFormatStandard is a mysql time.Time type with some helper functions
Variables ¶
var ErrInvalidHashKeyName = errors.New("invalid hash key name")
ErrInvalidHashKeyName hash key name is invalid error
var ErrInvalidHashKeyValue = errors.New("invalid hash key value")
ErrInvalidHashKeyValue hash key value is invalid error
var ErrInvalidPointerSliceType = errors.New("invalid type expected pointer of slice")
ErrInvalidPointerSliceType should be pointer of slice error
var ErrInvalidSliceType = errors.New("invalid type expected slice")
ErrInvalidSliceType interface should be slice error
var ErrInvalidTableName = errors.New("invalid table name")
ErrInvalidTableName table name is invalid error
var ErrNoItemFound = errors.New("no item found")
ErrNoItemFound item not found error
Functions ¶
func InterfaceToArrayOfInterface ¶
func InterfaceToArrayOfInterface(sliceOfItems interface{}) ([]interface{}, error)
InterfaceToArrayOfInterface transforms interface of slice to slice of interfaces
func IsPointerOFSlice ¶
func IsPointerOFSlice(item interface{}) bool
Types ¶
type DjoemoTime ¶
DjoemoTime ...
func (*DjoemoTime) MarshalDynamoDBAttributeValue ¶
func (dt *DjoemoTime) MarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
MarshalDynamoDBAttributeValue ...
func (*DjoemoTime) UnmarshalDynamoDBAttributeValue ¶
func (dt *DjoemoTime) UnmarshalDynamoDBAttributeValue(av *dynamodb.AttributeValue) error
UnmarshalDynamoDBAttributeValue ...
func (*DjoemoTime) UnmarshalJSON ¶
func (dt *DjoemoTime) UnmarshalJSON(p []byte) error
UnmarshalJSON checks before unmarshal it if a json timestamp is typical adjoe one format
type GlobalIndex ¶
type GlobalIndex struct {
// contains filtered or unexported fields
}
GlobalIndex models a global secondary index used in a query
func (GlobalIndex) GetItem ¶
func (gi GlobalIndex) GetItem(key KeyInterface, item interface{}) (bool, error)
GetItem get item; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in item returns true if item is found, returns false and nil if no item found, returns false and an error in case of error
func (GlobalIndex) GetItemWithContext ¶
func (gi GlobalIndex) GetItemWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error)
GetItemWithContext item; it needs a key interface that is used to get the table name, hash key, and the range key if it exists; output will be contained in item; context is optional param, which used to enable log with context
func (GlobalIndex) GetItems ¶
func (gi GlobalIndex) GetItems(key KeyInterface, items interface{}) (bool, error)
GetItems by key; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in items returns true if items are found, returns false and nil if no items found, returns false and error in case of error
func (GlobalIndex) GetItemsWithContext ¶
func (gi GlobalIndex) GetItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) (bool, error)
GetItemsWithContext queries multiple items by key (hash key) and returns it in the slice of items items
func (GlobalIndex) Query ¶
func (gi GlobalIndex) Query(query QueryInterface, item interface{}) error
Query by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; returns error in case of error
func (GlobalIndex) QueryWithContext ¶
func (gi GlobalIndex) QueryWithContext(ctx context.Context, query QueryInterface, item interface{}) error
QueryWithContext by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; context which used to enable log with context, the output will be given in items returns error in case of error
type GlobalIndexInterface ¶
type GlobalIndexInterface interface { // GetItemWithContext get item from index; it accepts a key interface that is used to get the table name, hash key and range key if it exists; // context which used to enable log with context; the output will be given in item // returns true if item is found, returns false and nil if no item found, returns false and an error in case of error GetItemWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error) // GetItemsWithContext by key from index; it accepts a key interface that is used to get the table name, hash key and range key if it exists; // context which used to enable log with context, the output will be given in items // returns true if items are found, returns false and nil if no items found, returns false and error in case of error GetItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) (bool, error) // GetItems by key; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in items // returns true if items are found, returns false and nil if no items found, returns false and error in case of error GetItems(key KeyInterface, items interface{}) (bool, error) // GetItem get item; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in item // returns true if item is found, returns false and nil if no item found, returns false and an error in case of error GetItem(key KeyInterface, item interface{}) (bool, error) // QueryWithContext by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; // context which used to enable log with context, the output will be given in items // returns error in case of error QueryWithContext(ctx context.Context, query QueryInterface, item interface{}) error // Query by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; // returns error in case of error Query(query QueryInterface, item interface{}) error }
type IteratorInterface ¶
type IteratorInterface interface {
NextItem(out interface{}) bool
}
IteratorInterface ...
type KeyInterface ¶
type KeyInterface interface { // TableName returns the djoemo table name TableName() string // HashKeyName returns the name of hash key if exists HashKeyName() *string // RangeKeyName returns the name of range key if exists RangeKeyName() *string // HashKey returns the hash key value HashKey() interface{} // HashKey returns the range key value RangeKey() interface{} }
KeyInterface provides an interface for djoemo key used to identify item in djoemo table
type LogInterface ¶
type LogInterface interface { // WithContext adds context to logger WithContext(ctx context.Context) LogInterface // WithFields adds fields from map string interface to logger WithFields(fields map[string]interface{}) LogInterface // Info logs info Info(message string) // warn logs warning Warn(message string) // error logs error Error(message string) }
LogInterface provides an interface for logging
type MetricsInterface ¶
type MetricsInterface interface { // WithContext adds context to logger WithContext(ctx context.Context) MetricsInterface // Publish publishes metrics Publish(key string, metricName string, metricValue float64) error }
MetricsInterface provides an interface for metrics publisher
type Model ¶
type Model struct { Version uint CreatedAt *DjoemoTime UpdatedAt *DjoemoTime }
Model ...
func (*Model) GetVersion ¶
GetVersion returns the current version of the item from dynamo
func (*Model) IncreaseVersion ¶
func (m *Model) IncreaseVersion()
IncreaseVersion increases the current version by 1
func (*Model) InitCreatedAt ¶
func (m *Model) InitCreatedAt()
InitCreatedAt sets the CreatedAt field of the item if it hasnt been set
type ModelInterface ¶
type ModelInterface interface { GetVersion() uint IncreaseVersion() InitCreatedAt() InitUpdatedAt() }
ModelInterface ...
type QueryInterface ¶
type QueryInterface interface { KeyInterface RangeOp() Operator Limit() *int64 Descending() bool }
QueryInterface provides an interface for djoemo query used to query item in djoemo table
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository facade for github.com/guregu/djoemo
func (Repository) ConditionalUpdate ¶
func (repository Repository) ConditionalUpdate(key KeyInterface, item interface{}, expression string, expressionArgs ...interface{}) (bool, error)
ConditionalUpdate updates an item when the condition is met, otherwise the update will be rejected
func (Repository) ConditionalUpdateWithContext ¶
func (repository Repository) ConditionalUpdateWithContext(ctx context.Context, key KeyInterface, item interface{}, expression string, expressionArgs ...interface{}) (bool, error)
ConditionalUpdateWithContext updates an item when the condition is met, otherwise the update will be rejected
func (*Repository) ConditionalUpdateWithUpdateExpressionsAndReturnValue ¶
func (repository *Repository) ConditionalUpdateWithUpdateExpressionsAndReturnValue( ctx context.Context, key KeyInterface, item interface{}, updateExpressions UpdateExpressions, conditionExpression string, conditionArgs ...interface{}, ) (conditionMet bool, err error)
ConditionalUpdateWithUpdateExpressionsAndReturnValue updates an item with update expressions and a condition. If the condition is met, the item will be updated and returned as it appears after the update. The first key of the updateMap specifies the Update expression to use for the expressions in the map
func (Repository) DeleteItem ¶
func (repository Repository) DeleteItem(key KeyInterface) error
DeleteItem item by key; returns error in case of error
func (*Repository) DeleteItemWithContext ¶
func (repository *Repository) DeleteItemWithContext(ctx context.Context, key KeyInterface) error
DeleteItemWithContext item by its key; it accepts key of item to be deleted; context which used to enable log with context returns error in case of error
func (Repository) DeleteItems ¶
func (repository Repository) DeleteItems(keys []KeyInterface) error
DeleteItems deletes items matching the keys
func (*Repository) DeleteItemsWithContext ¶
func (repository *Repository) DeleteItemsWithContext(ctx context.Context, keys []KeyInterface) error
DeleteItemsWithContext deletes items matching the keys; it accepts array of keys to be deleted; context which used to enable log with context returns error in case of error
func (Repository) GIndex ¶
func (repository Repository) GIndex(name string) GlobalIndexInterface
GIndex creates an index repository by name
func (Repository) GetItem ¶
func (repository Repository) GetItem(key KeyInterface, item interface{}) (bool, error)
GetItem get item; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in item returns true if item is found, returns false and nil if no item found, returns false and an error in case of error
func (*Repository) GetItemWithContext ¶
func (repository *Repository) GetItemWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error)
GetItemWithContext get item; it accepts a key interface that is used to get the table name, hash key and range key if it exists; context which used to enable log with context; the output will be given in item returns true if item is found, returns false and nil if no item found, returns false and an error in case of error
func (Repository) GetItems ¶
func (repository Repository) GetItems(key KeyInterface, items interface{}) (bool, error)
GetItems by key; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in items returns true if items are found, returns false and nil if no items found, returns false and error in case of error
func (*Repository) GetItemsWithContext ¶
func (repository *Repository) GetItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) (bool, error)
GetItemsWithContext by key; it accepts a key interface that is used to get the table name, hash key and range key if it exists; context which used to enable log with context, the output will be given in items returns true if items are found, returns false and nil if no items found, returns false and error in case of error
func (Repository) OptimisticLockSave ¶
func (repository Repository) OptimisticLockSave(key KeyInterface, item interface{}) (bool, error)
OptimisticLockSave updates an item if the version attribute on the server matches the one of the object
func (Repository) OptimisticLockSaveWithContext ¶
func (repository Repository) OptimisticLockSaveWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error)
OptimisticLockSaveWithContext saves an item if the version attribute on the server matches the version of the object
func (Repository) Query ¶
func (repository Repository) Query(query QueryInterface, item interface{}) error
Query by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; returns error in case of error
func (*Repository) QueryWithContext ¶
func (repository *Repository) QueryWithContext(ctx context.Context, query QueryInterface, item interface{}) error
QueryWithContext by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; context which used to enable log with context, the output will be given in items returns error in case of error
func (Repository) SaveItem ¶
func (repository Repository) SaveItem(key KeyInterface, item interface{}) error
SaveItem item; it accepts a key interface, that is used to get the table name; item is the item to be saved returns error in case of error
func (*Repository) SaveItemWithContext ¶
func (repository *Repository) SaveItemWithContext(ctx context.Context, key KeyInterface, item interface{}) error
SaveItemWithContext it accepts a key interface, that is used to get the table name; item is the item to be saved; context which used to enable log with context returns error in case of error
func (Repository) SaveItems ¶
func (repository Repository) SaveItems(key KeyInterface, items interface{}) error
SaveItems batch save a slice of items by key
func (*Repository) SaveItemsWithContext ¶
func (repository *Repository) SaveItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) error
SaveItemsWithContext batch save a slice of items by key; it accepts key of item to be saved; item to be saved; context which used to enable log with context returns error in case of error
func (Repository) ScanIteratorWithContext ¶
func (repository Repository) ScanIteratorWithContext(ctx context.Context, key KeyInterface, searchLimit int64) (IteratorInterface, error)
ScanIteratorWithContext returns an instance of an Iterator that provides methods for scanning tables
func (Repository) Update ¶
func (repository Repository) Update(expression UpdateExpression, key KeyInterface, values map[string]interface{}) error
Update updates item by key; it accepts an expression (Set, SetSet, SetIfNotExists, SetExpr); key is the key to be updated; values contains the values that should be used in the update; returns error in case of error
func (*Repository) UpdateWithContext ¶
func (repository *Repository) UpdateWithContext(ctx context.Context, expression UpdateExpression, key KeyInterface, values map[string]interface{}) error
UpdateWithContext updates item by key; it accepts an expression (Set, SetSet, SetIfNotExists, SetExpr); key is the key to be updated; values contains the values that should be used in the update; context which used to enable log with context returns error in case of error
func (*Repository) UpdateWithUpdateExpressions ¶
func (repository *Repository) UpdateWithUpdateExpressions( ctx context.Context, key KeyInterface, updateExpressions UpdateExpressions, ) error
UpdateWithUpdateExpressions updates an item with update expressions defined at field level, enabling you to set different update expressions for each field. The first key of the updateMap specifies the Update expression to use for the expressions in the map
func (*Repository) UpdateWithUpdateExpressionsAndReturnValue ¶
func (repository *Repository) UpdateWithUpdateExpressionsAndReturnValue( ctx context.Context, key KeyInterface, item interface{}, updateExpressions UpdateExpressions, ) error
UpdateWithUpdateExpressionsAndReturnValue updates an item with update expressions defined at field level and returns the item, as it appears after the update, enabling you to set different update expressions for each field. The first key of the updateMap specifies the Update expression to use for the expressions in the map
func (*Repository) WithLog ¶
func (repository *Repository) WithLog(log LogInterface)
WithLog enables logging; it accepts LogInterface as logger
func (*Repository) WithMetrics ¶
func (repository *Repository) WithMetrics(metricsInterface MetricsInterface)
WithMetrics enables metrics; it accepts MetricsInterface as metrics publisher
type RepositoryInterface ¶
type RepositoryInterface interface { // WithLog enables logging; it accepts LogInterface as logger WithLog(log LogInterface) // WithMetrics enables metrics; it accepts MetricsInterface as metrics publisher WithMetrics(metricsInterface MetricsInterface) // GetItem get item; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in item // returns true if item is found, returns false and nil if no item found, returns false and an error in case of error GetItem(key KeyInterface, item interface{}) (bool, error) // SaveItem item; it accepts a key interface, that is used to get the table name; item is the item to be saved // returns error in case of error SaveItem(key KeyInterface, item interface{}) error // Update updates item by key; it accepts an expression (Set, SetSet, SetIfNotExists, SetExpr); key is the key to be updated; // values contains the values that should be used in the update; // returns error in case of error Update(expression UpdateExpression, key KeyInterface, values map[string]interface{}) error // DeleteItem item by key; returns error in case of error DeleteItem(key KeyInterface) error // SaveItems batch save a slice of items by key; returns error in case of error SaveItems(key KeyInterface, items interface{}) error // DeleteItems deletes items matching the keys; returns error in case of error DeleteItems(key []KeyInterface) error // GetItems by key; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in items // returns true if items are found, returns false and nil if no items found, returns false and error in case of error GetItems(key KeyInterface, items interface{}) (bool, error) // GetItemWithContext get item; it accepts a key interface that is used to get the table name, hash key and range key if it exists; the output will be given in item // returns true if item is found, returns false and nil if no item found, returns false and an error in case of error GetItemWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error) // SaveItemWithContext it accepts a key interface, that is used to get the table name; item is the item to be saved; context which used to enable log with context // returns error in case of error SaveItemWithContext(ctx context.Context, key KeyInterface, item interface{}) error // UpdateWithContext updates item by key; it accepts an expression (Set, SetSet, SetIfNotExists, SetExpr); key is the key to be updated; // values contains the values that should be used in the update; context which used to enable log with context // returns error in case of error UpdateWithContext(ctx context.Context, expression UpdateExpression, key KeyInterface, values map[string]interface{}) error // UpdateWithUpdateExpressions updates an item with update expressions defined at field level, enabling you to set // different update expressions for each field. The first key of the updateMap specifies the Update expression to use // for the expressions in the map UpdateWithUpdateExpressions(ctx context.Context, key KeyInterface, updateExpressions UpdateExpressions) error // UpdateWithUpdateExpressionsAndReturnValue updates an item with update expressions defined at field level and returns // the item, as it appears after the update, enabling you to set different update expressions for each field. The first // key of the updateMap specifies the Update expression to use for the expressions in the map UpdateWithUpdateExpressionsAndReturnValue(ctx context.Context, key KeyInterface, item interface{}, updateExpressions UpdateExpressions) error // ConditionalUpdateWithUpdateExpressionsAndReturnValue updates an item with update expressions and a condition. // If the condition is met, the item will be updated and returned as it appears after the update. // The first key of the updateMap specifies the Update expression to use for the expressions in the map ConditionalUpdateWithUpdateExpressionsAndReturnValue(ctx context.Context, key KeyInterface, item interface{}, updateExpressions UpdateExpressions, conditionExpression string, conditionArgs ...interface{}) (conditionMet bool, err error) // DeleteItemWithContext item by its key; it accepts key of item to be deleted; context which used to enable log with context // returns error in case of error DeleteItemWithContext(ctx context.Context, key KeyInterface) error // SaveItemsWithContext batch save a slice of items by key; it accepts key of item to be saved; item to be saved; context which used to enable log with context // returns error in case of error SaveItemsWithContext(ctx context.Context, key KeyInterface, items interface{}) error // DeleteItemsWithContext deletes items matching the keys; it accepts array of keys to be deleted; context which used to enable log with context // returns error in case of error DeleteItemsWithContext(ctx context.Context, key []KeyInterface) error // GetItemsWithContext by key; it accepts key of item to get it; context which used to enable log with context // returns true if items are found, returns false and nil if no items found, returns false and error in case of error GetItemsWithContext(ctx context.Context, key KeyInterface, out interface{}) (bool, error) // QueryWithContext by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; // context which used to enable log with context, the output will be given in items // returns error in case of error QueryWithContext(ctx context.Context, query QueryInterface, item interface{}) error // Query by query; it accepts a query interface that is used to get the table name, hash key and range key with its operator if it exists; // returns error in case of error Query(query QueryInterface, item interface{}) error // GIndex returns index repository GIndex(name string) GlobalIndexInterface //OptimisticLockSaveWithContext saves an item if the version attribute on the server matches the version of the object OptimisticLockSaveWithContext(ctx context.Context, key KeyInterface, item interface{}) (bool, error) //OptimisticLockSave ... OptimisticLockSave(key KeyInterface, item interface{}) (bool, error) //ScanIteratorWithContext returns an instance of an iterator that provides methods to use for scanning tables ScanIteratorWithContext(ctx context.Context, key KeyInterface, searchLimit int64) (IteratorInterface, error) //ConditionalUpdateWithContext updates an item if the passed expression and condition evaluates to true ConditionalUpdateWithContext(ctx context.Context, key KeyInterface, item interface{}, expression string, expressionArgs ...interface{}) (bool, error) //ConditionalUpdate updates an item if the passed expression and condition evaluates to true ConditionalUpdate(key KeyInterface, item interface{}, expression string, expressionArgs ...interface{}) (bool, error) }
RepositoryInterface provides an interface to enable mocking the AWS dynamodb repository for testing your code.
func NewRepository ¶
func NewRepository(dynamoClient dynamodbiface.DynamoDBAPI) RepositoryInterface
NewRepository factory method for djoemo repository
type UpdateExpression ¶
type UpdateExpression string
const Add UpdateExpression = "ADD"
Add increments the path value in case of a number, or in case of a set it appends to that set. If a prior value doesn't exist it will set the path to that value.
const Set UpdateExpression = "Set"
Set changes path to the given value.
const SetExpr UpdateExpression = "SetExpr"
SetExpr performs a custom set expression, substituting the args into expr as in filter expressions.
const SetIfNotExists UpdateExpression = "SetIfNotExists"
SetIfNotExists changes path to the given value, if it does not already exist.
const SetSet UpdateExpression = "SetSet"
SetSet changes a set at the given path to the given value.
type UpdateExpressions ¶
type UpdateExpressions map[UpdateExpression]map[string]interface{}
UpdateExpressions is a type alias used for specifiyng multiple update expressions at once
Source Files ¶
- constant.go
- dynamo_global_index_interface.go
- dynamo_repository.go
- dynamo_repository_interface.go
- errors.go
- global_index.go
- iterator.go
- key.go
- key_interface.go
- log.go
- log_interface.go
- metrics.go
- metrics_interface.go
- model.go
- model_interface.go
- query.go
- query_interface.go
- reflect_helper.go
- time.go
- update_expression.go