Documentation ¶
Index ¶
- Constants
- func And(left, right expression.ConditionBuilder, other ...expression.ConditionBuilder) expression.ConditionBuilder
- func AttributeExists(attribute string) expression.ConditionBuilder
- func AttributeNotExists(attribute string) expression.ConditionBuilder
- func Between(attribute string, lower interface{}, upper interface{}) expression.ConditionBuilder
- func Eq(attribute string, value interface{}) expression.ConditionBuilder
- func GetTableNameWithSettings(tableSettings *Settings, namingSettings *TableNamingSettings) string
- func Gt(attribute string, value interface{}) expression.ConditionBuilder
- func Gte(attribute string, value interface{}) expression.ConditionBuilder
- func IsTableNotFoundError(err error) bool
- func Lt(attribute string, value interface{}) expression.ConditionBuilder
- func Lte(attribute string, value interface{}) expression.ConditionBuilder
- func MarshalMap(in interface{}) (map[string]types.AttributeValue, error)
- func MetadataReadFields(model interface{}) ([]string, error)
- func NewDecoder() *attributevalue.Decoder
- func NewEncoder() *attributevalue.Encoder
- func NewMetricRepository(_ cfg.Config, _ log.Logger, repo Repository) *metricRepository
- func NewTransactionRepository(ctx context.Context, config cfg.Config, logger log.Logger, name string) (*transactionRepository, error)
- func NewTransactionRepositoryWithInterfaces(logger log.Logger, client gosoDynamodb.Client, tracer tracing.Tracer) *transactionRepository
- func Not(cond expression.ConditionBuilder) expression.ConditionBuilder
- func NotEq(attribute string, value interface{}) expression.ConditionBuilder
- func Or(left, right expression.ConditionBuilder, other ...expression.ConditionBuilder) expression.ConditionBuilder
- func TableName(config cfg.Config, settings *Settings) string
- func UnmarshalList(l []types.AttributeValue, out interface{}) error
- func UnmarshalListOfMaps(l []map[string]types.AttributeValue, out interface{}) error
- func UnmarshalMap(m map[string]types.AttributeValue, out interface{}) error
- type Attribute
- type Attributes
- type BatchGetItemsBuilder
- type Capacity
- type ConditionCheckBuilder
- type ConsumedCapacity
- type DeleteItemBuilder
- type DeleteItemResult
- type FieldAware
- type GetItemBuilder
- type GetItemResult
- type GlobalSettings
- type KeyAware
- type KeyValues
- type LocalSettings
- type MainSettings
- type Metadata
- type MetadataFactory
- type OperationResult
- type Progress
- type PutItemBuilder
- type PutItemResult
- type QueryBuilder
- type QueryOperation
- type QueryResult
- type Repository
- type ResultCallback
- type ScanBuilder
- type ScanOperation
- type ScanResult
- type Service
- type Settings
- type SimpleSettings
- type TableDescription
- type TableMetadata
- type TableNamingSettings
- type TableNotFoundError
- type TransactConditionCheck
- type TransactDeleteItem
- type TransactGetItem
- type TransactGetItemBuilder
- type TransactPutItem
- type TransactUpdateItem
- type TransactWriteItemBuilder
- type TransactionRepository
- type Unmarshaller
- type UpdateItemBuilder
- type UpdateItemResult
Constants ¶
View Source
const ( MetadataKeyTables = "cloud.aws.dynamodb.tables" MetricNameAccessSuccess = "DdbAccessSuccess" MetricNameAccessFailure = "DdbAccessFailure" MetricNameAccessLatency = "DdbAccessLatency" OpSave = "save" StreamViewTypeNewImage = types.StreamViewTypeNewImage StreamViewTypeOldImage = types.StreamViewTypeOldImage StreamViewTypeNewAndOldImages = types.StreamViewTypeNewAndOldImages StreamViewTypeKeysOnly = types.StreamViewTypeKeysOnly Create = "create" Update = "update" Delete = "delete" )
Variables ¶
This section is empty.
Functions ¶
func And ¶
func And(left, right expression.ConditionBuilder, other ...expression.ConditionBuilder) expression.ConditionBuilder
func AttributeExists ¶
func AttributeExists(attribute string) expression.ConditionBuilder
func AttributeNotExists ¶
func AttributeNotExists(attribute string) expression.ConditionBuilder
func Between ¶
func Between(attribute string, lower interface{}, upper interface{}) expression.ConditionBuilder
func Eq ¶
func Eq(attribute string, value interface{}) expression.ConditionBuilder
func GetTableNameWithSettings ¶
func GetTableNameWithSettings(tableSettings *Settings, namingSettings *TableNamingSettings) string
func Gt ¶
func Gt(attribute string, value interface{}) expression.ConditionBuilder
func Gte ¶
func Gte(attribute string, value interface{}) expression.ConditionBuilder
func IsTableNotFoundError ¶
func Lt ¶
func Lt(attribute string, value interface{}) expression.ConditionBuilder
func Lte ¶
func Lte(attribute string, value interface{}) expression.ConditionBuilder
func MarshalMap ¶
func MarshalMap(in interface{}) (map[string]types.AttributeValue, error)
func MetadataReadFields ¶
func NewDecoder ¶
func NewDecoder() *attributevalue.Decoder
func NewEncoder ¶
func NewEncoder() *attributevalue.Encoder
func NewMetricRepository ¶
func NewMetricRepository(_ cfg.Config, _ log.Logger, repo Repository) *metricRepository
func Not ¶
func Not(cond expression.ConditionBuilder) expression.ConditionBuilder
func NotEq ¶
func NotEq(attribute string, value interface{}) expression.ConditionBuilder
func Or ¶
func Or(left, right expression.ConditionBuilder, other ...expression.ConditionBuilder) expression.ConditionBuilder
func UnmarshalList ¶
func UnmarshalList(l []types.AttributeValue, out interface{}) error
func UnmarshalListOfMaps ¶
func UnmarshalListOfMaps(l []map[string]types.AttributeValue, out interface{}) error
func UnmarshalMap ¶
func UnmarshalMap(m map[string]types.AttributeValue, out interface{}) error
Types ¶
type Attribute ¶
type Attributes ¶
func ReadAttributes ¶
func ReadAttributes(model interface{}) (Attributes, error)
type BatchGetItemsBuilder ¶
type BatchGetItemsBuilder interface { WithKeys(values ...interface{}) BatchGetItemsBuilder WithKeyPairs(pairs [][]interface{}) BatchGetItemsBuilder WithHashKeys(hashKeys interface{}) BatchGetItemsBuilder DisableTtlFilter() BatchGetItemsBuilder WithProjection(projection interface{}) BatchGetItemsBuilder WithConsistentRead(consistentRead bool) BatchGetItemsBuilder Build(result interface{}) (*dynamodb.BatchGetItemInput, error) }
func NewBatchGetItemsBuilder ¶
func NewBatchGetItemsBuilder(metadata *Metadata, clock clock.Clock) BatchGetItemsBuilder
type ConditionCheckBuilder ¶
type ConditionCheckBuilder interface { Build(result interface{}) (*types.ConditionCheck, error) ReturnNone() ConditionCheckBuilder ReturnAllOld() ConditionCheckBuilder WithHash(hashValue interface{}) ConditionCheckBuilder WithRange(rangeValue interface{}) ConditionCheckBuilder WithKeys(keys ...interface{}) ConditionCheckBuilder WithCondition(cond expression.ConditionBuilder) ConditionCheckBuilder }
func NewConditionCheckBuilder ¶
func NewConditionCheckBuilder(metadata *Metadata) ConditionCheckBuilder
type ConsumedCapacity ¶
type DeleteItemBuilder ¶
type DeleteItemBuilder interface { WithHash(hashValue interface{}) DeleteItemBuilder WithRange(rangeValue interface{}) DeleteItemBuilder WithCondition(cond expression.ConditionBuilder) DeleteItemBuilder ReturnNone() DeleteItemBuilder ReturnAllOld() DeleteItemBuilder Build(item interface{}) (*dynamodb.DeleteItemInput, error) }
func NewDeleteItemBuilder ¶
func NewDeleteItemBuilder(metadata *Metadata) DeleteItemBuilder
type DeleteItemResult ¶
type DeleteItemResult struct { ConditionalCheckFailed bool ConsumedCapacity *ConsumedCapacity }
type FieldAware ¶
type GetItemBuilder ¶
type GetItemBuilder interface { WithHash(hashValue interface{}) GetItemBuilder WithRange(rangeValue interface{}) GetItemBuilder WithKeys(keys ...interface{}) GetItemBuilder DisableTtlFilter() GetItemBuilder WithProjection(rangeValue interface{}) GetItemBuilder WithConsistentRead(consistentRead bool) GetItemBuilder Build(result interface{}) (*dynamodb.GetItemInput, error) }
func NewGetItemBuilder ¶
func NewGetItemBuilder(metadata *Metadata, clock clock.Clock) GetItemBuilder
type GetItemResult ¶
type GetItemResult struct { IsFound bool ConsumedCapacity *ConsumedCapacity }
type GlobalSettings ¶
type KeyValues ¶
type KeyValues map[string]types.AttributeValue
type LocalSettings ¶
type LocalSettings struct { Name string Model interface{} }
type MainSettings ¶
type MainSettings struct { Model interface{} StreamView types.StreamViewType ReadCapacityUnits int64 WriteCapacityUnits int64 }
type Metadata ¶
type Metadata struct { TableName string Attributes Attributes TimeToLive metadataTtl Main metadataMain Local metaLocal Global metaGlobal }
func (*Metadata) Index ¶
func (d *Metadata) Index(name string) FieldAware
type MetadataFactory ¶
type MetadataFactory struct {
// contains filtered or unexported fields
}
func NewMetadataFactory ¶
func NewMetadataFactory(config cfg.Config, settings *Settings) *MetadataFactory
func NewMetadataFactoryWithInterfaces ¶
func NewMetadataFactoryWithInterfaces(settings *Settings, tableName string) *MetadataFactory
func (*MetadataFactory) GetMetadata ¶
func (f *MetadataFactory) GetMetadata() (*Metadata, error)
func (*MetadataFactory) GetSettings ¶
func (f *MetadataFactory) GetSettings() *Settings
func (*MetadataFactory) GetTableName ¶
func (f *MetadataFactory) GetTableName() string
type OperationResult ¶
type OperationResult struct {
ConsumedCapacity *ConsumedCapacity
}
type Progress ¶
type Progress interface { GetRequestCount() int32 GetItemCount() int32 GetScannedCount() int32 GetConsumedCapacity() *ConsumedCapacity }
type PutItemBuilder ¶
type PutItemBuilder interface { WithCondition(cond expression.ConditionBuilder) PutItemBuilder ReturnNone() PutItemBuilder ReturnAllOld() PutItemBuilder Build(item interface{}) (*dynamodb.PutItemInput, error) }
func NewPutItemBuilder ¶
func NewPutItemBuilder(metadata *Metadata) PutItemBuilder
type PutItemResult ¶
type PutItemResult struct { ConditionalCheckFailed bool ConsumedCapacity *ConsumedCapacity IsReturnEmpty bool }
type QueryBuilder ¶
type QueryBuilder interface { WithIndex(name string) QueryBuilder WithHash(value interface{}) QueryBuilder WithRangeBetween(lower interface{}, upper interface{}) QueryBuilder WithRangeBeginsWith(prefix string) QueryBuilder WithRangeEq(value interface{}) QueryBuilder WithRangeGt(value interface{}) QueryBuilder WithRangeGte(value interface{}) QueryBuilder WithRangeLt(value interface{}) QueryBuilder WithRangeLte(value interface{}) QueryBuilder WithFilter(filter expression.ConditionBuilder) QueryBuilder DisableTtlFilter() QueryBuilder WithProjection(projection interface{}) QueryBuilder WithLimit(limit int) QueryBuilder WithPageSize(size int) QueryBuilder WithDescendingOrder() QueryBuilder WithConsistentRead(consistentRead bool) QueryBuilder Build(result interface{}) (*QueryOperation, error) }
func NewQueryBuilder ¶
func NewQueryBuilder(metadata *Metadata, clock clock.Clock) QueryBuilder
type QueryOperation ¶
type QueryOperation struct {
// contains filtered or unexported fields
}
type QueryResult ¶
type QueryResult struct { RequestCount int32 ItemCount int32 ScannedCount int32 ConsumedCapacity *ConsumedCapacity }
func (QueryResult) GetConsumedCapacity ¶
func (q QueryResult) GetConsumedCapacity() *ConsumedCapacity
func (QueryResult) GetItemCount ¶
func (q QueryResult) GetItemCount() int32
func (QueryResult) GetRequestCount ¶
func (q QueryResult) GetRequestCount() int32
func (QueryResult) GetScannedCount ¶
func (q QueryResult) GetScannedCount() int32
type Repository ¶
type Repository interface { GetModelId() mdl.ModelId BatchDeleteItems(ctx context.Context, value interface{}) (*OperationResult, error) BatchGetItems(ctx context.Context, qb BatchGetItemsBuilder, result interface{}) (*OperationResult, error) BatchPutItems(ctx context.Context, items interface{}) (*OperationResult, error) DeleteItem(ctx context.Context, db DeleteItemBuilder, item interface{}) (*DeleteItemResult, error) GetItem(ctx context.Context, qb GetItemBuilder, result interface{}) (*GetItemResult, error) PutItem(ctx context.Context, qb PutItemBuilder, item interface{}) (*PutItemResult, error) Query(ctx context.Context, qb QueryBuilder, result interface{}) (*QueryResult, error) Scan(ctx context.Context, sb ScanBuilder, result interface{}) (*ScanResult, error) UpdateItem(ctx context.Context, ub UpdateItemBuilder, item interface{}) (*UpdateItemResult, error) BatchGetItemsBuilder() BatchGetItemsBuilder DeleteItemBuilder() DeleteItemBuilder GetItemBuilder() GetItemBuilder QueryBuilder() QueryBuilder PutItemBuilder() PutItemBuilder ScanBuilder() ScanBuilder UpdateItemBuilder() UpdateItemBuilder }
func NewRepository ¶
func NewRepository(ctx context.Context, config cfg.Config, logger log.Logger, settings *Settings, optFns ...gosoDynamodb.ClientOption) (Repository, error)
func NewWithInterfaces ¶
func NewWithInterfaces(logger log.Logger, tracer tracing.Tracer, client gosoDynamodb.Client, metadataFactory *MetadataFactory) (Repository, error)
type ResultCallback ¶
type ScanBuilder ¶
type ScanBuilder interface { WithIndex(name string) ScanBuilder WithFilter(filter expression.ConditionBuilder) ScanBuilder DisableTtlFilter() ScanBuilder WithProjection(projection interface{}) ScanBuilder WithLimit(limit int) ScanBuilder WithPageSize(size int) ScanBuilder WithSegment(segment int, total int) ScanBuilder WithConsistentRead(consistentRead bool) ScanBuilder Build(result interface{}) (*ScanOperation, error) }
func NewScanBuilder ¶
func NewScanBuilder(metadata *Metadata, clock clock.Clock) ScanBuilder
type ScanOperation ¶
type ScanOperation struct {
// contains filtered or unexported fields
}
type ScanResult ¶
type ScanResult struct { RequestCount int32 ItemCount int32 ScannedCount int32 ConsumedCapacity *ConsumedCapacity }
func (ScanResult) GetConsumedCapacity ¶
func (s ScanResult) GetConsumedCapacity() *ConsumedCapacity
func (ScanResult) GetItemCount ¶
func (s ScanResult) GetItemCount() int32
func (ScanResult) GetRequestCount ¶
func (s ScanResult) GetRequestCount() int32
func (ScanResult) GetScannedCount ¶
func (s ScanResult) GetScannedCount() int32
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewServiceWithInterfaces ¶
func NewServiceWithInterfaces(logger log.Logger, client gosoDynamodb.Client, metadataFactory *MetadataFactory) *Service
func (*Service) DescribeTable ¶
func (s *Service) DescribeTable(ctx context.Context) (*TableDescription, error)
type Settings ¶
type Settings struct { ModelId mdl.ModelId TableNamingSettings TableNamingSettings AutoCreate bool DisableTracing bool ClientName string Main MainSettings Local []LocalSettings Global []GlobalSettings }
type SimpleSettings ¶
type TableDescription ¶
type TableMetadata ¶
type TableNamingSettings ¶
type TableNamingSettings struct {
Pattern string `cfg:"pattern,nodecode" default:"{project}-{env}-{family}-{group}-{modelId}"`
}
func GetTableNamingSettings ¶
func GetTableNamingSettings(config cfg.Config, clientName string) *TableNamingSettings
type TableNotFoundError ¶
type TableNotFoundError struct { TableName string // contains filtered or unexported fields }
func NewTableNotFoundError ¶
func NewTableNotFoundError(tableName string, err error) TableNotFoundError
func (TableNotFoundError) Error ¶
func (t TableNotFoundError) Error() string
func (TableNotFoundError) Unwrap ¶
func (t TableNotFoundError) Unwrap() error
type TransactConditionCheck ¶
type TransactConditionCheck struct { Builder ConditionCheckBuilder Item interface{} }
func (*TransactConditionCheck) Build ¶
func (b *TransactConditionCheck) Build() (*types.TransactWriteItem, error)
func (*TransactConditionCheck) GetItem ¶
func (b *TransactConditionCheck) GetItem() interface{}
type TransactDeleteItem ¶
type TransactDeleteItem struct { Builder DeleteItemBuilder Item interface{} }
func (*TransactDeleteItem) Build ¶
func (b *TransactDeleteItem) Build() (*types.TransactWriteItem, error)
func (*TransactDeleteItem) GetItem ¶
func (b *TransactDeleteItem) GetItem() interface{}
type TransactGetItem ¶
type TransactGetItem struct { Builder GetItemBuilder Item interface{} }
func (*TransactGetItem) Build ¶
func (b *TransactGetItem) Build() (types.TransactGetItem, error)
func (*TransactGetItem) GetItem ¶
func (b *TransactGetItem) GetItem() interface{}
type TransactGetItemBuilder ¶
type TransactGetItemBuilder interface { Build() (types.TransactGetItem, error) GetItem() interface{} }
type TransactPutItem ¶
type TransactPutItem struct { Builder PutItemBuilder Item interface{} }
func NewTransactionPutItemBuilder ¶
func NewTransactionPutItemBuilder() *TransactPutItem
func (*TransactPutItem) Build ¶
func (b *TransactPutItem) Build() (*types.TransactWriteItem, error)
func (*TransactPutItem) GetItem ¶
func (b *TransactPutItem) GetItem() interface{}
type TransactUpdateItem ¶
type TransactUpdateItem struct { Builder UpdateItemBuilder Item interface{} }
func (*TransactUpdateItem) Build ¶
func (b *TransactUpdateItem) Build() (*types.TransactWriteItem, error)
func (*TransactUpdateItem) GetItem ¶
func (b *TransactUpdateItem) GetItem() interface{}
type TransactWriteItemBuilder ¶
type TransactWriteItemBuilder interface { Build() (*types.TransactWriteItem, error) GetItem() interface{} }
type TransactionRepository ¶
type TransactionRepository interface { TransactWriteItems(ctx context.Context, items []TransactWriteItemBuilder) (*OperationResult, error) TransactGetItems(ctx context.Context, items []TransactGetItemBuilder) (*OperationResult, error) }
type Unmarshaller ¶
type Unmarshaller struct {
// contains filtered or unexported fields
}
func NewUnmarshallerFromPtrSlice ¶
func NewUnmarshallerFromPtrSlice(result interface{}) (*Unmarshaller, error)
func NewUnmarshallerFromStruct ¶
func NewUnmarshallerFromStruct(model interface{}) (*Unmarshaller, error)
func (*Unmarshaller) Append ¶
func (u *Unmarshaller) Append(items []map[string]types.AttributeValue) error
func (*Unmarshaller) Unmarshal ¶
func (u *Unmarshaller) Unmarshal(items []map[string]types.AttributeValue) (interface{}, error)
type UpdateItemBuilder ¶
type UpdateItemBuilder interface { WithHash(hashValue interface{}) UpdateItemBuilder WithRange(rangeValue interface{}) UpdateItemBuilder WithCondition(cond expression.ConditionBuilder) UpdateItemBuilder Add(path string, value interface{}) UpdateItemBuilder Delete(path string, value interface{}) UpdateItemBuilder Set(path string, value interface{}) UpdateItemBuilder SetMap(values map[string]interface{}) UpdateItemBuilder SetIfNotExist(path string, value interface{}) UpdateItemBuilder Remove(path string) UpdateItemBuilder RemoveMultiple(paths ...string) UpdateItemBuilder ReturnNone() UpdateItemBuilder ReturnAllOld() UpdateItemBuilder ReturnUpdatedOld() UpdateItemBuilder ReturnAllNew() UpdateItemBuilder ReturnUpdatedNew() UpdateItemBuilder Build(item interface{}) (*dynamodb.UpdateItemInput, error) }
func NewUpdateItemBuilder ¶
func NewUpdateItemBuilder(metadata *Metadata) UpdateItemBuilder
type UpdateItemResult ¶
type UpdateItemResult struct { ConditionalCheckFailed bool ConsumedCapacity *ConsumedCapacity }
Source Files ¶
- builder.go
- builder_batchgetitems.go
- builder_conditioncheck.go
- builder_deleteitem.go
- builder_getitem.go
- builder_putitem.go
- builder_query.go
- builder_scan.go
- builder_transactgetitem_get.go
- builder_transactwriteitem.go
- builder_transactwriteitem_conditioncheck.go
- builder_transactwriteitem_delete.go
- builder_transactwriteitem_put.go
- builder_transactwriteitem_update.go
- builder_updateitem.go
- capacity.go
- error.go
- expr_condition.go
- expr_filter.go
- expr_projection.go
- marshal.go
- metadata.go
- metadata_attributes.go
- metadata_factory.go
- metric_repo.go
- naming.go
- page_iterator.go
- reflect.go
- repository.go
- repository_transaction.go
- response.go
- service.go
- settings.go
- unmarshal.go
Click to show internal directories.
Click to hide internal directories.