orm

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DocumentName = "doc"
View Source
const EpsilonEqual = EpsilonOperator("==")
View Source
const EpsilonNotEqual = EpsilonOperator("!=")
View Source
const EqualityExpressionEqual = EqualityOperator("==")
View Source
const EqualityExpressionGreaterThan = EqualityOperator(">")
View Source
const EqualityExpressionGreaterThanOrEqualTo = EqualityOperator(">=")
View Source
const EqualityExpressionLessThan = EqualityOperator("<")
View Source
const EqualityExpressionLessThanOrEqualTo = EqualityOperator("<=")
View Source
const EqualityExpressionNotEqual = EqualityOperator("!=")
View Source
const VarPrefix = "var"

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

func NewAttribute

func NewAttribute(name string) interface{}

func ReadDoc

func ReadDoc(objFactory ObjectFactory, reader Reader) (interface{}, error)

Types

type AndExpression

type AndExpression struct {
	// contains filtered or unexported fields
}

func (*AndExpression) String

func (c *AndExpression) String() string

type Collection

type Collection struct {
	Connection        *Connection
	TableName         string
	OrganizationIdKey string
	AllocateRecord    ObjectFactory
}

func (*Collection) Create

func (c *Collection) Create(ctx context.Context, obj interface{}) (string, error)

func (*Collection) Delete

func (c *Collection) Delete(ctx context.Context, obj interface{}) error

func (*Collection) Drop

func (c *Collection) Drop(ctx context.Context) error

func (*Collection) Get

func (c *Collection) Get(ctx context.Context, id string) (interface{}, error)

func (*Collection) Increment

func (c *Collection) Increment(ctx context.Context, obj interface{}, varName string) error

func (*Collection) Initialize

func (c *Collection) Initialize(ctx context.Context) error

func (*Collection) Query

func (c *Collection) Query() *CollectionFilter

func (*Collection) Update

func (c *Collection) Update(ctx context.Context, obj interface{}) error

type CollectionFilter

type CollectionFilter struct {
	// contains filtered or unexported fields
}

func (*CollectionFilter) ArrayEmpty added in v0.1.5

func (c *CollectionFilter) ArrayEmpty(arrayName string) *CollectionFilter

func (*CollectionFilter) ById

func (c *CollectionFilter) ById(docId string) *CollectionFilter

func (*CollectionFilter) Count

func (c *CollectionFilter) Count(ctx context.Context) (int, error)

func (*CollectionFilter) DeleteAll

func (c *CollectionFilter) DeleteAll(ctx context.Context) ([]string, error)

func (*CollectionFilter) Filter

func (c *CollectionFilter) Filter(key string, value interface{}) *CollectionFilter

func (*CollectionFilter) First

func (c *CollectionFilter) First(ctx context.Context) (interface{}, error)

func (*CollectionFilter) InArray

func (c *CollectionFilter) InArray(value string, arrayName string) *CollectionFilter

func (*CollectionFilter) InArrayOfDocuments

func (c *CollectionFilter) InArrayOfDocuments(value string, arrayName string, documentKey string) *CollectionFilter

func (*CollectionFilter) List

func (c *CollectionFilter) List() *ItemsOperator

func (*CollectionFilter) Operator

func (c *CollectionFilter) Operator() *Operator

func (*CollectionFilter) UpdateAll

func (c *CollectionFilter) UpdateAll(ctx context.Context, updates map[string]interface{}) ([]string, error)

func (*CollectionFilter) Where

func (c *CollectionFilter) Where(expression Expression) *CollectionFilter

func (*CollectionFilter) WithinOrg

func (c *CollectionFilter) WithinOrg(orgId string) *CollectionFilter

type Connection

type Connection struct {
	Database driver.Database
	Client   driver.Client
}

func NewConnection

func NewConnection(ctx context.Context, databaseName, dbUser, dbPass, dbUrl string) (*Connection, error)

type DocumentAttribute

type DocumentAttribute struct {
	// contains filtered or unexported fields
}

func (*DocumentAttribute) Name

func (c *DocumentAttribute) Name() string

func (*DocumentAttribute) String

func (c *DocumentAttribute) String() string

type EmptyArrayExpression added in v0.1.5

type EmptyArrayExpression struct {
	// contains filtered or unexported fields
}

func (*EmptyArrayExpression) String added in v0.1.5

func (c *EmptyArrayExpression) String() string

type EpsilonExpression added in v0.1.4

type EpsilonExpression struct {
	// contains filtered or unexported fields
}

func (*EpsilonExpression) String added in v0.1.4

func (c *EpsilonExpression) String() string

type EpsilonOperator added in v0.1.4

type EpsilonOperator string

type EqualityExpression

type EqualityExpression struct {
	// contains filtered or unexported fields
}

func (*EqualityExpression) String

func (c *EqualityExpression) String() string

type EqualityOperator

type EqualityOperator string

type Expression

type Expression interface {
	String() string
}

func RawValue

func RawValue(value interface{}) Expression

type ExpressionWrapper

type ExpressionWrapper struct {
	// contains filtered or unexported fields
}

func (*ExpressionWrapper) String

func (c *ExpressionWrapper) String() string

type InArrayExpression

type InArrayExpression struct {
	// contains filtered or unexported fields
}

func (*InArrayExpression) String

func (c *InArrayExpression) String() string

type ItemsOperator

type ItemsOperator struct {
	// contains filtered or unexported fields
}

func (*ItemsOperator) All

func (c *ItemsOperator) All(ctx context.Context) ([]interface{}, error)

func (*ItemsOperator) First added in v0.1.3

func (c *ItemsOperator) First(ctx context.Context) (interface{}, error)

func (*ItemsOperator) Limit

func (c *ItemsOperator) Limit(count int) *ItemsOperator

func (*ItemsOperator) OrderBy

func (c *ItemsOperator) OrderBy(key string) *OrderBy

func (*ItemsOperator) Paging

func (c *ItemsOperator) Paging(pageSize, page int) *ItemsOperator

func (*ItemsOperator) RandomOrder

func (c *ItemsOperator) RandomOrder() *ItemsOperator

type LikeExpression

type LikeExpression struct {
	// contains filtered or unexported fields
}

func (*LikeExpression) String

func (c *LikeExpression) String() string

type NativeExpression

type NativeExpression struct {
	// contains filtered or unexported fields
}

func (*NativeExpression) String

func (c *NativeExpression) String() string

type NotExpression

type NotExpression struct {
	// contains filtered or unexported fields
}

func (*NotExpression) String

func (c *NotExpression) String() string

type ObjectFactory

type ObjectFactory func() interface{}

type Operator

type Operator struct {
	// contains filtered or unexported fields
}

func (*Operator) And

func (c *Operator) And(left, right Expression) Expression

func (*Operator) Contains

func (c *Operator) Contains(attribute string, pattern string) Expression

func (*Operator) EndsWith

func (c *Operator) EndsWith(attribute string, pattern string) Expression

func (*Operator) Equal

func (c *Operator) Equal(attribute string, right interface{}) Expression

func (*Operator) GreaterThan

func (c *Operator) GreaterThan(attribute string, right Expression) Expression

func (*Operator) GreaterThanOrEqual

func (c *Operator) GreaterThanOrEqual(attribute string, right Expression) Expression

func (*Operator) IsEmpty added in v0.1.4

func (c *Operator) IsEmpty(attribute string) Expression

func (*Operator) IsNotEmpty added in v0.1.4

func (c *Operator) IsNotEmpty(attribute string) Expression

func (*Operator) IsNotNull added in v0.1.4

func (c *Operator) IsNotNull(attribute string) Expression

func (*Operator) IsNull added in v0.1.4

func (c *Operator) IsNull(attribute string) Expression

func (*Operator) LessThan

func (c *Operator) LessThan(attribute string, right Expression) Expression

func (*Operator) LessThanOrEqual

func (c *Operator) LessThanOrEqual(attribute string, right Expression) Expression

func (*Operator) MakeVariableIfNative

func (c *Operator) MakeVariableIfNative(input interface{}) Expression

func (*Operator) Not

func (c *Operator) Not(expression interface{}) Expression

func (*Operator) Or

func (c *Operator) Or(left, right Expression) Expression

func (*Operator) StartsWith

func (c *Operator) StartsWith(attribute string, pattern string) Expression

type OrExpression

type OrExpression struct {
	// contains filtered or unexported fields
}

func (*OrExpression) String

func (c *OrExpression) String() string

type Order

type Order interface {
	OrderFormat() string
}

type OrderBy

type OrderBy struct {
	// contains filtered or unexported fields
}

func (*OrderBy) Asc

func (c *OrderBy) Asc() *ItemsOperator

func (*OrderBy) Desc

func (c *OrderBy) Desc() *ItemsOperator

func (*OrderBy) OrderFormat

func (c *OrderBy) OrderFormat() string

type Paging

type Paging struct {
	OffsetVar Variable
	CountVar  Variable
}

func (*Paging) FormatPaging

func (c *Paging) FormatPaging() string

type QueryVariable

type QueryVariable struct {
	// contains filtered or unexported fields
}

func (*QueryVariable) String

func (c *QueryVariable) String() string

type Rand

type Rand struct{}

func (*Rand) OrderFormat

func (c *Rand) OrderFormat() string

type Reader

type Reader func(map[string]interface{}) error

type Variable

type Variable interface {
	String() string
}

type VariableFactory

type VariableFactory struct {
	// contains filtered or unexported fields
}

func NewVariableFactory

func NewVariableFactory() *VariableFactory

func (*VariableFactory) MakeVariable

func (c *VariableFactory) MakeVariable(value interface{}) Variable

func (*VariableFactory) SymbolTable

func (c *VariableFactory) SymbolTable() map[string]interface{}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL