Documentation
¶
Index ¶
- Constants
- Variables
- func Bool(value bool) *types.AttributeValueMemberBOOL
- func Bytes(value []byte) *types.AttributeValueMemberB
- func Count(ctx context.Context, cli DescribeClient, tableName string) (int64, error)
- func Delete(ctx context.Context, cli WriteClient, items WriteItemFunc, ...) (*dynamodb.DeleteItemOutput, error)
- func Describe(ctx context.Context, cli DescribeClient, tableName string) (*dynamodb.DescribeTableOutput, error)
- func EnableErrorWithEmptyList(v bool)
- func EqualFilter[T any](filter expression.ConditionBuilder, name string, value T) expression.ConditionBuilder
- func EqualKey[T any](condition expression.KeyConditionBuilder, name string, value T) expression.KeyConditionBuilder
- func Get(ctx context.Context, cli GetClient, getKeys GetKeyFunc, fetch FetchItemFunc, ...) (*dynamodb.GetItemOutput, error)
- func InFilter[T any](filter expression.ConditionBuilder, name string, value T, values ...T) expression.ConditionBuilder
- func IsNil(record interface{}) bool
- func IsNotFound(err error) bool
- func List(value ...*types.AttributeValue) *types.AttributeValueMemberL
- func NotExistsFilter[T any](filter expression.ConditionBuilder, name string, value T) expression.ConditionBuilder
- func NotFound(tableName string) *types.ResourceNotFoundException
- func Null() *types.AttributeValueMemberNULL
- func Number(value string) *types.AttributeValueMemberN
- func NumberSet(value ...string) *types.AttributeValueMemberNS
- func Put(ctx context.Context, cli WriteClient, items WriteItemFunc, ...) (*dynamodb.PutItemOutput, error)
- func Query(ctx context.Context, cli QueryClient, condition QueryConditionFunc, ...) (*dynamodb.QueryOutput, error)
- func RangeFilter[T any](filter expression.ConditionBuilder, name string, begin, end *T) expression.ConditionBuilder
- func RangeKey[T any](condition expression.KeyConditionBuilder, name string, begin, end *T) expression.KeyConditionBuilder
- func Scan(ctx context.Context, cli ScanClient, condition ScanFilterFunc, ...) (*dynamodb.ScanOutput, error)
- func ScanAll(ctx context.Context, cli ScanClient, condition ScanFilterFunc, ...) (out *dynamodb.ScanOutput, err error)
- func Setup(ctx context.Context, option ...ConfigOption) (cli *dynamodb.Client, err error)
- func Share(cli *dynamodb.Client)
- func Shared() *dynamodb.Client
- func String(value string) *types.AttributeValueMemberS
- func Update(ctx context.Context, cli WriteClient, items WriteItemFunc, ...) (*dynamodb.UpdateItemOutput, error)
- func UpdateBuilder(ctx context.Context, fields ...UpdateField) expression.UpdateBuilder
- func Values[T any](values ...T) (right expression.OperandBuilder, other []expression.OperandBuilder)
- type Client
- type Config
- type ConfigBuilder
- type ConfigOption
- type DescribeClient
- type EnvBuilder
- type EvaluatedKey
- type EvaluatedValue
- type ExpressionFunc
- type FetchItemFunc
- type FetchItemPostprocessor
- type FetchItemsFunc
- type FetchItemsPostprocessor
- type GetClient
- type GetItemFunc
- type GetKeyFunc
- type OptionBuilder
- type PutItemPreprocessor
- type QueryClient
- type QueryConditionFunc
- type Record
- type Records
- type ScanClient
- type ScanFilterFunc
- type UpdateField
- type WriteClient
- type WriteItemFunc
- func ConsistentUpdateItem(ctx context.Context, keyFunc GetKeyFunc, fieldName string, count int, ...) WriteItemFunc
- func DeleteItem(keyFunc GetKeyFunc) WriteItemFunc
- func PutItem(ctx context.Context, tableName string, rec any, f ...ExpressionFunc) WriteItemFunc
- func UpdateItem(ctx context.Context, keyFunc GetKeyFunc, fields ...UpdateField) WriteItemFunc
Constants ¶
View Source
const (
MaxInItems = 100
)
Variables ¶
View Source
var ErrNotFound *types.ResourceNotFoundException
Functions ¶
func Bool ¶ added in v0.1.21
func Bool(value bool) *types.AttributeValueMemberBOOL
func Bytes ¶ added in v0.1.21
func Bytes(value []byte) *types.AttributeValueMemberB
func Delete ¶
func Delete(ctx context.Context, cli WriteClient, items WriteItemFunc, opt ...options.Option) (*dynamodb.DeleteItemOutput, error)
func Describe ¶ added in v0.1.21
func Describe(ctx context.Context, cli DescribeClient, tableName string) (*dynamodb.DescribeTableOutput, error)
func EnableErrorWithEmptyList ¶ added in v0.1.7
func EnableErrorWithEmptyList(v bool)
EnableErrorWithEmptyList Make the list return an error if it is empty.
func EqualFilter ¶ added in v0.1.21
func EqualFilter[T any](filter expression.ConditionBuilder, name string, value T) expression.ConditionBuilder
func EqualKey ¶ added in v0.1.21
func EqualKey[T any](condition expression.KeyConditionBuilder, name string, value T) expression.KeyConditionBuilder
func Get ¶
func Get(ctx context.Context, cli GetClient, getKeys GetKeyFunc, fetch FetchItemFunc, opt ...options.Option) (*dynamodb.GetItemOutput, error)
func InFilter ¶ added in v0.1.21
func InFilter[T any](filter expression.ConditionBuilder, name string, value T, values ...T) expression.ConditionBuilder
func IsNotFound ¶
func List ¶ added in v0.1.21
func List(value ...*types.AttributeValue) *types.AttributeValueMemberL
func NotExistsFilter ¶ added in v0.1.21
func NotExistsFilter[T any](filter expression.ConditionBuilder, name string, value T) expression.ConditionBuilder
func NotFound ¶ added in v0.1.4
func NotFound(tableName string) *types.ResourceNotFoundException
func Null ¶ added in v0.1.21
func Null() *types.AttributeValueMemberNULL
func Number ¶ added in v0.1.21
func Number(value string) *types.AttributeValueMemberN
func NumberSet ¶ added in v0.1.21
func NumberSet(value ...string) *types.AttributeValueMemberNS
func Put ¶
func Put(ctx context.Context, cli WriteClient, items WriteItemFunc, opt ...options.Option) (*dynamodb.PutItemOutput, error)
func Query ¶ added in v0.0.2
func Query(ctx context.Context, cli QueryClient, condition QueryConditionFunc, fetch FetchItemsFunc, opt ...options.Option) (*dynamodb.QueryOutput, error)
func RangeFilter ¶ added in v0.1.21
func RangeFilter[T any](filter expression.ConditionBuilder, name string, begin, end *T) expression.ConditionBuilder
func RangeKey ¶ added in v0.1.21
func RangeKey[T any](condition expression.KeyConditionBuilder, name string, begin, end *T) expression.KeyConditionBuilder
func Scan ¶ added in v0.0.6
func Scan(ctx context.Context, cli ScanClient, condition ScanFilterFunc, fetch FetchItemsFunc, opt ...options.Option) (*dynamodb.ScanOutput, error)
func ScanAll ¶ added in v0.1.16
func ScanAll(ctx context.Context, cli ScanClient, condition ScanFilterFunc, fetch FetchItemsFunc, opt ...options.Option) (out *dynamodb.ScanOutput, err error)
func String ¶ added in v0.1.21
func String(value string) *types.AttributeValueMemberS
func Update ¶
func Update(ctx context.Context, cli WriteClient, items WriteItemFunc, opt ...options.Option) (*dynamodb.UpdateItemOutput, error)
func UpdateBuilder ¶ added in v0.1.3
func UpdateBuilder(ctx context.Context, fields ...UpdateField) expression.UpdateBuilder
func Values ¶ added in v0.1.13
func Values[T any](values ...T) (right expression.OperandBuilder, other []expression.OperandBuilder)
Types ¶
type Client ¶ added in v0.1.3
type Client interface {
GetClient
ScanClient
QueryClient
WriteClient
DescribeClient
}
type ConfigBuilder ¶ added in v0.1.11
type ConfigBuilder interface {
Build(ctx context.Context) []ConfigOption
}
type ConfigOption ¶ added in v0.1.17
type ConfigOption func(*Config)
func AwsConfig ¶ added in v0.1.17
func AwsConfig(cfg *aws.Config) ConfigOption
func Debug ¶ added in v0.1.17
func Debug() ConfigOption
func EnabledTracing ¶ added in v0.1.17
func EnabledTracing() ConfigOption
func Endpoint ¶ added in v0.1.17
func Endpoint(endpoint string) ConfigOption
func Local ¶ added in v0.1.17
func Local() ConfigOption
func Profile ¶ added in v0.1.17
func Profile(profile string) ConfigOption
func Region ¶ added in v0.1.17
func Region(region string) ConfigOption
type DescribeClient ¶ added in v0.1.21
type DescribeClient interface {
DescribeTable(ctx context.Context, params *dynamodb.DescribeTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DescribeTableOutput, error)
}
type EnvBuilder ¶ added in v0.1.11
type EnvBuilder struct{}
func (*EnvBuilder) Build ¶ added in v0.1.11
func (b *EnvBuilder) Build(ctx context.Context) (options []ConfigOption)
type EvaluatedKey ¶ added in v0.1.9
type EvaluatedKey map[string]types.AttributeValue
func EvaluatedKeyOf ¶ added in v0.1.9
func EvaluatedKeyOf(key string) (EvaluatedKey, error)
func (EvaluatedKey) String ¶ added in v0.1.9
func (ek EvaluatedKey) String() (string, error)
type EvaluatedValue ¶ added in v0.1.9
type ExpressionFunc ¶ added in v0.1.6
type ExpressionFunc func() (expr expression.Expression, err error)
type FetchItemFunc ¶
type FetchItemPostprocessor ¶ added in v0.1.11
type FetchItemsFunc ¶ added in v0.0.2
func FetchItems ¶ added in v0.1.3
func FetchItems[T any](ctx context.Context, rec *T) FetchItemsFunc
type FetchItemsPostprocessor ¶ added in v0.1.11
type GetClient ¶
type GetClient interface {
GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
}
type GetItemFunc ¶ added in v0.0.9
type GetItemFunc WriteItemFunc
type GetKeyFunc ¶
type OptionBuilder ¶ added in v0.1.12
type OptionBuilder struct {
Local bool
Region string
Endpoint string
Profile string
Debug bool
EnabledTracing bool
Cfg *aws.Config
}
func (*OptionBuilder) Build ¶ added in v0.1.12
func (b *OptionBuilder) Build(ctx context.Context) (options []ConfigOption)
type PutItemPreprocessor ¶ added in v0.1.3
type QueryClient ¶ added in v0.0.2
type QueryClient interface {
Query(ctx context.Context, params *dynamodb.QueryInput, optFns ...func(*dynamodb.Options)) (*dynamodb.QueryOutput, error)
}
type QueryConditionFunc ¶ added in v0.0.2
type QueryConditionFunc func() (table, index string, expr expression.Expression, err error)
type Record ¶ added in v0.1.9
type Record map[string]types.AttributeValue
type Records ¶ added in v0.1.9
type Records []map[string]types.AttributeValue
type ScanClient ¶ added in v0.0.6
type ScanFilterFunc ¶ added in v0.1.3
type ScanFilterFunc func() (table string, expr expression.Expression, err error)
type UpdateField ¶
type UpdateField func(ctx context.Context, builder *expression.UpdateBuilder) expression.UpdateBuilder
func AddValue ¶ added in v0.1.17
func AddValue(name string, value any) UpdateField
func DeleteValue ¶ added in v0.1.17
func DeleteValue(name string, value any) UpdateField
func RemoveValue ¶ added in v0.1.17
func RemoveValue(name string) UpdateField
func SetValue ¶ added in v0.1.17
func SetValue(name string, value any) UpdateField
func UpdateValue ¶ added in v0.1.3
func UpdateValue(name string, value any) UpdateField
type WriteClient ¶
type WriteClient interface {
PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
UpdateItem(ctx context.Context, params *dynamodb.UpdateItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateItemOutput, error)
DeleteItem(ctx context.Context, params *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
}
type WriteItemFunc ¶
type WriteItemFunc func() (table string, item map[string]types.AttributeValue, expr expression.Expression, err error)
func ConsistentUpdateItem ¶ added in v0.1.3
func ConsistentUpdateItem(ctx context.Context, keyFunc GetKeyFunc, fieldName string, count int, fields ...UpdateField) WriteItemFunc
func DeleteItem ¶ added in v0.1.3
func DeleteItem(keyFunc GetKeyFunc) WriteItemFunc
func PutItem ¶ added in v0.1.3
func PutItem(ctx context.Context, tableName string, rec any, f ...ExpressionFunc) WriteItemFunc
func UpdateItem ¶ added in v0.1.3
func UpdateItem(ctx context.Context, keyFunc GetKeyFunc, fields ...UpdateField) WriteItemFunc
Click to show internal directories.
Click to hide internal directories.