Documentation
¶
Index ¶
- func InstantiateDynamoClient(region string) error
- type DynamoItem
- type Table
- func (d *Table) Add(i DynamoItem) error
- func (d *Table) Delete(i DynamoItem) error
- func (d *Table) Get(i DynamoItem) (map[string]types.AttributeValue, error)
- func (d *Table) GetByGSI(i DynamoItem, val any) ([]map[string]types.AttributeValue, error)
- func (d *Table) GetOneByGSI(i DynamoItem, val any) (map[string]types.AttributeValue, error)
- func (d *Table) Scan() ([]map[string]types.AttributeValue, error)
- func (d *Table) Update(i DynamoItem, key, value string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InstantiateDynamoClient ¶
instantiates a dynamo client with the region in the environment variable AWS_REGION, or the region provided in the argument if the environment variable is not found
Types ¶
type DynamoItem ¶
type DynamoItem interface { // MarshalMap is identical to the aws SDK's MarshalMap function MarshalMap() (map[string]types.AttributeValue, error) // Returns the primary key map of the item GetPrimaryKeyMap() map[string]types.AttributeValue // Returns the GSI name and gsi attribute name of the item, // or an empty string if the item does not have a GSI configured. GetGSI() (gsi string, attr string) // Sets attributes found in the GetItemOutput to its own attributes. // Attributes in the argument that are not found will be ignored. UnmarshalMap(o map[string]types.AttributeValue) }
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func GetTableClient ¶
returns a table client for the table specified
func (*Table) Delete ¶
func (d *Table) Delete(i DynamoItem) error
func (*Table) Get ¶
func (d *Table) Get(i DynamoItem) (map[string]types.AttributeValue, error)
get one item from the table
func (*Table) GetByGSI ¶
func (d *Table) GetByGSI(i DynamoItem, val any) ([]map[string]types.AttributeValue, error)
get a list of items, searching by the GSI. you can think of this as searching by the GSI for when the GSI's attribute is equal to 'val'
func (*Table) GetOneByGSI ¶
func (d *Table) GetOneByGSI(i DynamoItem, val any) (map[string]types.AttributeValue, error)
like GetByGSI, but only returns the first value the query finds. Useful for when you know only one item matches the query.
Click to show internal directories.
Click to hide internal directories.