Documentation
¶
Index ¶
- func GetFieldValue(value reflect.Value, fieldPath string) (reflect.Value, bool)
- func ParseModelName(q interface{}) (string, error)
- func SetField(item interface{}, fieldName string, value interface{}) error
- func ValidateInput(q interface{}, operation, structName string) error
- type Deconstructed
- type DynamoDBAPI
- type Model
- type Operator
- func (o *Operator) All(q interface{}) *Operator
- func (o *Operator) Create(q interface{}) *Operator
- func (o *Operator) Delete(q interface{}) *Operator
- func (o *Operator) Find(q interface{}, id string) *Operator
- func (o *Operator) Save(q interface{}) *Operator
- func (o *Operator) SoftDelete(q interface{}) *Operator
- func (o *Operator) Update(q interface{}, k string, v interface{}) *Operator
- func (o *Operator) Where(q interface{}, k string, v interface{}) *Operator
- func (o *Operator) WhereV2(isChain bool, q interface{}, fieldName string, fieldValue interface{}) *Operator
- func (o *Operator) WhereV3(isChain bool, q interface{}, fieldName string, fieldValue interface{}) *Operator
- func (o *Operator) WhereV4(isChain bool, q interface{}, fieldName string, fieldValue interface{}) *Operator
- type WhereV4Condition
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetFieldValue ¶
func ParseModelName ¶
func ValidateInput ¶
Types ¶
type Deconstructed ¶
type DynamoDBAPI ¶
type DynamoDBAPI interface {
CreateTable(ctx context.Context, params *dynamodb.CreateTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.CreateTableOutput, error)
DescribeTable(ctx context.Context, params *dynamodb.DescribeTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DescribeTableOutput, error)
PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
DeleteItem(ctx context.Context, params *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
UpdateItem(ctx context.Context, params *dynamodb.UpdateItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateItemOutput, error)
Query(ctx context.Context, params *dynamodb.QueryInput, optFns ...func(*dynamodb.Options)) (*dynamodb.QueryOutput, error)
Scan(ctx context.Context, params *dynamodb.ScanInput, optFns ...func(*dynamodb.Options)) (*dynamodb.ScanOutput, error)
}
DynamoDBAPI defines the interface for DynamoDB operations This allows us to mock the DynamoDB client for testing
type Operator ¶
type Operator struct {
Err error
IsWhereChain bool
PendingConditions []WhereV4Condition
IsWhereV4Chain bool
// contains filtered or unexported fields
}
func NewMagicModelOperator ¶
func NewMagicModelOperatorWithClient ¶
func NewMagicModelOperatorWithClient(dbClient DynamoDBAPI, tableName string) *Operator
NewMagicModelOperatorWithClient creates a new operator with a custom DynamoDB client This is useful for testing with mock clients
func (*Operator) SoftDelete ¶
func (*Operator) WhereV2 ¶
func (o *Operator) WhereV2(isChain bool, q interface{}, fieldName string, fieldValue interface{}) *Operator
WhereV2 filters a collection based on a field name and value This is a simpler version of WhereV3 that only supports string comparisons Can be chained with other Where calls when isChain is true
func (*Operator) WhereV3 ¶
func (o *Operator) WhereV3(isChain bool, q interface{}, fieldName string, fieldValue interface{}) *Operator
WhereV3 filters a collection based on a field name and value Can be chained with other Where calls when isChain is true
func (*Operator) WhereV4 ¶
func (o *Operator) WhereV4(isChain bool, q interface{}, fieldName string, fieldValue interface{}) *Operator
WhereV4 filters a collection based on a field name and value(s) with deferred execution Supports both single values and arrays for OR conditions within the same field Can be chained with other WhereV4 calls when isChain is true
type WhereV4Condition ¶
type WhereV4Condition struct {
FieldName string
FieldValues []interface{}
}