objectref

package
v1.4.5-alpha1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2019 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package objectref intended to unify and simplify a way of model instance changes tracking (currently not implemented)

Index

Constants

View Source
const (
	ConstErrorModule = "objectref"
	ConstErrorLevel  = env.ConstErrorLevelHelper
)

Package global constants

Variables

This section is empty.

Functions

This section is empty.

Types

type DBObjectRef

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

DBObjectRef is a object state tracking helper and implementer of InterfaceObject and InterfaceStorable

func (*DBObjectRef) Delete

func (it *DBObjectRef) Delete() error

Delete removes current object instance from DB

func (*DBObjectRef) FromHashMap

func (it *DBObjectRef) FromHashMap(input map[string]interface{}) error

FromHashMap fills attributes values based on provided map

func (*DBObjectRef) Get

func (it *DBObjectRef) Get(attribute string) interface{}

Get returns attribute value for current object or nil if no such attribute

func (*DBObjectRef) GetAttributesInfo

func (it *DBObjectRef) GetAttributesInfo() []models.StructAttributeInfo

GetAttributesInfo returns stub information about current object attributes

  • if you using this helper you should rewrite this function in your class

func (*DBObjectRef) GetID

func (it *DBObjectRef) GetID() string

GetID returns current object id

func (*DBObjectRef) IsLoaded

func (it *DBObjectRef) IsLoaded() bool

IsLoaded returns value of load from DB flag

func (*DBObjectRef) IsModified

func (it *DBObjectRef) IsModified() bool

IsModified returns value of modification flag

func (*DBObjectRef) Load

func (it *DBObjectRef) Load(id string) error

Load loads information from DB

func (*DBObjectRef) MarkAsLoaded

func (it *DBObjectRef) MarkAsLoaded()

MarkAsLoaded marks object instance as loaded from DB

func (*DBObjectRef) MarkAsModified

func (it *DBObjectRef) MarkAsModified()

MarkAsModified marks object instance as modified

func (*DBObjectRef) Save

func (it *DBObjectRef) Save() error

Save stores current product to DB

func (*DBObjectRef) Set

func (it *DBObjectRef) Set(attribute string, value interface{}) error

Set sets attribute value for current object

func (*DBObjectRef) SetID

func (it *DBObjectRef) SetID(id string)

SetID sets new id to current object

func (*DBObjectRef) ToHashMap

func (it *DBObjectRef) ToHashMap() map[string]interface{}

ToHashMap returns attribute values that current object holds

Jump to

Keyboard shortcuts

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