Documentation
¶
Index ¶
- func GetItem[T any](client types.DynamoClientAPI, input *dynamodb.GetItemInput) (*T, error)
- func Query[T any](client types.DynamoClientAPI, input *dynamodb.QueryInput) ([]T, error)
- func Scan[T any](client types.DynamoClientAPI, input *dynamodb.ScanInput) ([]T, error)
- func UpdateItem[T any](client types.DynamoClientAPI, table string, ...) (*T, error)
- type DynamoAPI
- func (api DynamoAPI) Create(req types.Request, item map[string]interface{}, ...) error
- func (api DynamoAPI) Delete(request types.Request, partitionKey map[string]interface{}) error
- func (api *DynamoAPI) DeleteItem(table string, key map[string]dynamoTypes.AttributeValue, ...) error
- func (api DynamoAPI) Get(req types.Request, id string) (types.Record, error)
- func (api DynamoAPI) GetAuth(id string) (*types.User, error)
- func (api DynamoAPI) GetEntitlements(entitlementIDs []string) ([]types.User, error)
- func (api DynamoAPI) GetGroup(id string) (*types.Group, error)
- func (api DynamoAPI) History(req types.Request, key string, value string, queryParams map[string][]string, ...) ([]types.History, error)
- func (api DynamoAPI) List(req types.Request) ([]types.Record, error)
- func (api DynamoAPI) ListAuditLogs(req types.Request, pathParams map[string]string, ...) ([]types.AuditLog, error)
- func (api DynamoAPI) ListUniqueValues(req types.Request, uniqueKey string) ([]string, error)
- func (api *DynamoAPI) PutItem(table string, item interface{}, expr *expression.Expression) error
- func (api DynamoAPI) Search(req types.Request, key string, values []string) ([]types.Record, error)
- func (api DynamoAPI) Update(request types.Request, partitionKey map[string]interface{}, ...) (interface{}, error)
- type DynamoFiltering
- func (f *DynamoFiltering) And(condition1, condition2 interface{}) interface{}
- func (f *DynamoFiltering) Between(key string, values interface{}) (interface{}, error)
- func (f *DynamoFiltering) BuildInExpr(attr string, values []string, negate bool) expression.ConditionBuilder
- func (f *DynamoFiltering) Contains(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) Equals(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) Exists(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) GreaterThan(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) GreaterThanEqual(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) In(key string, values interface{}) (interface{}, error)
- func (f *DynamoFiltering) LessThan(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) LessThanEqual(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) NotContains(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) NotEqual(key string, value interface{}) (interface{}, error)
- func (f *DynamoFiltering) NotIn(key string, values interface{}) (interface{}, error)
- func (f *DynamoFiltering) Operations() base.OperationMap
- func (f *DynamoFiltering) Or(condition1, condition2 interface{}) interface{}
- func (f *DynamoFiltering) StartsWith(key string, value interface{}) (interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetItem ¶
func GetItem[T any](client types.DynamoClientAPI, input *dynamodb.GetItemInput) (*T, error)
func Query ¶
func Query[T any](client types.DynamoClientAPI, input *dynamodb.QueryInput) ([]T, error)
func UpdateItem ¶
func UpdateItem[T any](client types.DynamoClientAPI, table string, key map[string]dynamoTypes.AttributeValue, expr expression.Expression) (*T, error)
Types ¶
type DynamoAPI ¶
type DynamoAPI struct { *base.Scoutr Client types.DynamoClientAPI // contains filtered or unexported fields }
DynamoAPI : API, based off of Scoutr, used to talk to AWS DynamoDB
func (DynamoAPI) Create ¶
func (api DynamoAPI) Create(req types.Request, item map[string]interface{}, validation map[string]types.FieldValidation, requiredFields []string) error
Create : Create an item
func (*DynamoAPI) DeleteItem ¶
func (api *DynamoAPI) DeleteItem(table string, key map[string]dynamoTypes.AttributeValue, expr *expression.Expression) error
func (DynamoAPI) GetAuth ¶
GetAuth : Fetch an auth identity from the collection Responses:
- nil, nil: user does not exist
- nil, error: error while fetching user
- user, nil: found user
func (DynamoAPI) GetEntitlements ¶
GetEntitlements: Fetch entitlements from the database
func (DynamoAPI) GetGroup ¶
GetGroup : Fetch a group from the collection Responses:
- nil, nil: group does not exist
- nil, error: error while fetching group
- user, nil: found group
func (DynamoAPI) History ¶
func (api DynamoAPI) History(req types.Request, key string, value string, queryParams map[string][]string, actions []string) ([]types.History, error)
History : Generate record history
func (DynamoAPI) ListAuditLogs ¶
func (api DynamoAPI) ListAuditLogs(req types.Request, pathParams map[string]string, queryParams map[string][]string) ([]types.AuditLog, error)
ListAuditLogs : List audit logs
func (DynamoAPI) ListUniqueValues ¶
ListUniqueValues : Lists unique values in a table
func (*DynamoAPI) PutItem ¶
func (api *DynamoAPI) PutItem(table string, item interface{}, expr *expression.Expression) error
type DynamoFiltering ¶
func NewFilter ¶
func NewFilter() DynamoFiltering
func (*DynamoFiltering) And ¶
func (f *DynamoFiltering) And(condition1, condition2 interface{}) interface{}
And : Takes two conditions and performs an AND operation on them
func (*DynamoFiltering) Between ¶
func (f *DynamoFiltering) Between(key string, values interface{}) (interface{}, error)
Between : Check for records that are between a low and high value
Operator: key__between=["1", "2"]
func (*DynamoFiltering) BuildInExpr ¶
func (f *DynamoFiltering) BuildInExpr(attr string, values []string, negate bool) expression.ConditionBuilder
Build a condition expression using the IN operator If there are more than 100 values, expressions will be split up into 100-value groupings and combined together using the OR operation.
In order to negate the expression (i.e. not in), specify negate = true.
func (*DynamoFiltering) Contains ¶
func (f *DynamoFiltering) Contains(key string, value interface{}) (interface{}, error)
Contains : Check if a value contains a string
func (*DynamoFiltering) Equals ¶
func (f *DynamoFiltering) Equals(key string, value interface{}) (interface{}, error)
Equals : Standard equals operation
func (*DynamoFiltering) Exists ¶
func (f *DynamoFiltering) Exists(key string, value interface{}) (interface{}, error)
Exists : Checks if an attribute exists. Only accepts true/false values. Returns nil for all other values.
func (*DynamoFiltering) GreaterThan ¶
func (f *DynamoFiltering) GreaterThan(key string, value interface{}) (interface{}, error)
GreaterThan : Check if a value is greater than a string
func (*DynamoFiltering) GreaterThanEqual ¶
func (f *DynamoFiltering) GreaterThanEqual(key string, value interface{}) (interface{}, error)
GreaterThanEqual : Check if a value is greater than a string
func (*DynamoFiltering) In ¶
func (f *DynamoFiltering) In(key string, values interface{}) (interface{}, error)
In : Find all records with a list of values
func (*DynamoFiltering) LessThan ¶
func (f *DynamoFiltering) LessThan(key string, value interface{}) (interface{}, error)
LessThan : Check if a value is greater than a string
func (*DynamoFiltering) LessThanEqual ¶
func (f *DynamoFiltering) LessThanEqual(key string, value interface{}) (interface{}, error)
LessThanEqual : Check if a value is greater than a string
func (*DynamoFiltering) NotContains ¶
func (f *DynamoFiltering) NotContains(key string, value interface{}) (interface{}, error)
NotContains : Check for values that do not contain a string
func (*DynamoFiltering) NotEqual ¶
func (f *DynamoFiltering) NotEqual(key string, value interface{}) (interface{}, error)
NotEqual : Standard not equals operation
func (*DynamoFiltering) NotIn ¶
func (f *DynamoFiltering) NotIn(key string, values interface{}) (interface{}, error)
NotIn : Find all records without a list of values
func (*DynamoFiltering) Operations ¶
func (f *DynamoFiltering) Operations() base.OperationMap
Operations : Map of supported operations for this filter provider
func (*DynamoFiltering) Or ¶
func (f *DynamoFiltering) Or(condition1, condition2 interface{}) interface{}
Or : Takes two conditions and performs an OR operation on them
func (*DynamoFiltering) StartsWith ¶
func (f *DynamoFiltering) StartsWith(key string, value interface{}) (interface{}, error)
StartsWith : Find all records that contain items that start with a specific value