entityUtils

package
v0.0.0-...-e2c1db5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2015 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_QUERY_LIMIT = 1500
)

Variables

View Source
var (
	OrmRepo = iOrmRepo(new(beegoOrmRepo))
)

Functions

func AddToListOfOrmModelsToRegister

func AddToListOfOrmModelsToRegister(entityModelToRegister iEntity)

func DefaultRegisterModel

func DefaultRegisterModel(entityInstance interface{})

func DoesStructContainField

func DoesStructContainField(structObj interface{}, fieldName string) bool

func ForeachOrmModelToRegister

func ForeachOrmModelToRegister(function func(interface{}))

func GetAllFieldNamesOfStruct

func GetAllFieldNamesOfStruct(structObj interface{}, ignoreSettings *IgnoreFieldTypes) []string

func SetFormValues

func SetFormValues(from interface{}, to interface{}, skipTheseFields, onlyIncludeTheseFields []string)

set values from one struct to other struct both need ptr struct

func ToStr

func ToStr(value interface{}, args ...int) (s string)

Types

type AndQueryFilterContainer

type AndQueryFilterContainer struct {
	OrList []*OrQueryFilterContainer
}

func AndQueryFilterContainer__Constructor

func AndQueryFilterContainer__Constructor(orList []*OrQueryFilterContainer) *AndQueryFilterContainer

type ChangedField

type ChangedField struct {
	FieldName string
	OldValue  string
	NewValue  string
}

func FormChanges

func FormChanges(base interface{}, modified interface{}, skipTheseFields, onlyIncludeTheseFields []string) (fields []ChangedField)

compare field values between two struct pointer return changed field names

type FieldWithValue

type FieldWithValue struct {
	FieldName  string
	FieldValue string
}

func GetAllFieldsOfStruct

func GetAllFieldsOfStruct(structObj interface{}, ignoreSettings *IgnoreFieldTypes) (fieldNames []FieldWithValue)

type IgnoreFieldTypes

type IgnoreFieldTypes struct {
	//Which field types to ignore when using GetAllFieldsOfStruct
	OrmSkipped  bool
	Created     bool
	Updated     bool
	Relationals bool //All fields that have orm "reverse(..." or "rel(..."
}

type OrQueryFilterContainer

type OrQueryFilterContainer struct {
	IsNot      bool
	Expression string
	Arguments  []interface{}
}

func OrQueryFilterContainer__Constructor

func OrQueryFilterContainer__Constructor(isNot bool, expression string, arguments ...interface{}) *OrQueryFilterContainer

type OrmContext

type OrmContext struct {
	Logger     ILogger
	OrmWrapper *OrmWrapper
}

func CreateDefaultOrmContext

func CreateDefaultOrmContext() *OrmContext

func CreateOrmContext

func CreateOrmContext(logger ILogger, possibleParentTransactionalOrmWrapper *OrmWrapper, beginTransaction bool) *OrmContext

func CreateOrmContext_FromAnother

func CreateOrmContext_FromAnother(ormContext *OrmContext, beginTransaction bool) *OrmContext

func CreateOrmContext_FromAnother_ButCreateNewOrmWrapper

func CreateOrmContext_FromAnother_ButCreateNewOrmWrapper(ormContext *OrmContext, beginTransaction bool) *OrmContext

func (*OrmContext) CommitOnSuccessOrRollbackOnPanic

func (this *OrmContext) CommitOnSuccessOrRollbackOnPanic()

func (*OrmContext) RecoverAndPrintIfPanic_Error

func (this *OrmContext) RecoverAndPrintIfPanic_Error(additionalMessageNoFullStop string, funcOnErrorCatched func(interface{}), funcOnFinally func())

type OrmWrapper

type OrmWrapper struct {
	OrmInstance               orm.Ormer
	LocallyManageTransactions bool
}

func CreateNewOrmWrapper

func CreateNewOrmWrapper(possibleParentTransactionalOrmWrapper *OrmWrapper) *OrmWrapper

func (*OrmWrapper) BeginTransaction

func (this *OrmWrapper) BeginTransaction()

func (*OrmWrapper) CommitTransaction

func (this *OrmWrapper) CommitTransaction()

func (*OrmWrapper) RollbackTransaction

func (this *OrmWrapper) RollbackTransaction()

func (*OrmWrapper) RollbackTransaction_NoPanic

func (this *OrmWrapper) RollbackTransaction_NoPanic()

type QueryFilter

type QueryFilter struct {
	AndList []*AndQueryFilterContainer
}

func QueryFilter__Constructor

func QueryFilter__Constructor(andList []*AndQueryFilterContainer) *QueryFilter

func QueryFilter__Constructor__Empty

func QueryFilter__Constructor__Empty() *QueryFilter

func QueryFilter__Constructor__SingleCheck

func QueryFilter__Constructor__SingleCheck(isNot bool, expression string, arguments ...interface{}) *QueryFilter

type QueryListInput

type QueryListInput struct {
	Limit         int64
	Offset        int64
	QueryFilter   *QueryFilter
	RelatedFields *RelatedFieldsToLoad
	OrderByFields []string
}

func QueryListInput_Construct

func QueryListInput_Construct(limit, offset int64, queryFilter *QueryFilter, relatedFields *RelatedFieldsToLoad, orderByFields ...string) *QueryListInput

func (*QueryListInput) ExecuteQuery

func (this *QueryListInput) ExecuteQuery(ormContext *OrmContext, tableName string, sliceToPopulatePointer interface{})

type RelatedField

type RelatedField struct {
	FieldName string

	//CanRelatedSel is TRUE for
	// ForeignKey
	// Rel(one)
	//But FALSE for
	// Rev(one)
	// Rev Many
	// M2M
	CanRelatedSel bool
}

func CreateRelatedField

func CreateRelatedField(fieldName string, canRelatedSel bool) *RelatedField

type RelatedFieldsToLoad

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

func CreateRelatedFieldsToLoad

func CreateRelatedFieldsToLoad(relatedFields ...*RelatedField) *RelatedFieldsToLoad

func (*RelatedFieldsToLoad) AppendIfTrue

func (this *RelatedFieldsToLoad) AppendIfTrue(checkIfTrue bool, relatedFieldToAppend *RelatedField)

func (*RelatedFieldsToLoad) GetFieldNames

func (this *RelatedFieldsToLoad) GetFieldNames(includeCanRelatedSel, includeNOTcanRelatedSel bool) []string

Jump to

Keyboard shortcuts

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