block

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: 8 Imported by: 0

Documentation

Overview

Package block is a default implementation of cms block related interfaces declared in "github.com/ottemo/commerce/app/models/csm" package

Index

Constants

View Source
const (
	ConstCmsBlockCollectionName = "cms_block"

	ConstErrorModule = "cms/block"
	ConstErrorLevel  = env.ConstErrorLevelActor
)

Package global constants

Variables

This section is empty.

Functions

func APICreateCMSBlock

func APICreateCMSBlock(context api.InterfaceApplicationContext) (interface{}, error)

APICreateCMSBlock creates a new CMS block

  • CMS block attributes should be specified in request content

func APIDeleteCMSBlock

func APIDeleteCMSBlock(context api.InterfaceApplicationContext) (interface{}, error)

APIDeleteCMSBlock deletes existing CMS block

  • CMS block id should be specified in "blockID" argument

func APIGetCMSBlock

func APIGetCMSBlock(context api.InterfaceApplicationContext) (interface{}, error)

APIGetCMSBlock return specified CMS block information

  • CMS block id should be specified in "blockID" argument
  • CMS block content can be a text template, so "evaluated" field in response is that template evaluation result

func APIListCMSBlockAttributes

func APIListCMSBlockAttributes(context api.InterfaceApplicationContext) (interface{}, error)

APIListCMSBlockAttributes returns a list of CMS block attributes

func APIListCMSBlocks

func APIListCMSBlocks(context api.InterfaceApplicationContext) (interface{}, error)

APIListCMSBlocks returns a list of existing CMS blocks

  • if "action" parameter is set to "count" result value will be just a number of list items

func APIUpdateCMSBlock

func APIUpdateCMSBlock(context api.InterfaceApplicationContext) (interface{}, error)

APIUpdateCMSBlock updates existing CMS block

  • CMS block id should be specified in "blockID" argument

Types

type DefaultCMSBlock

type DefaultCMSBlock struct {
	Identifier string
	Content    string

	CreatedAt time.Time
	UpdatedAt time.Time
	// contains filtered or unexported fields
}

DefaultCMSBlock is a default implementer of InterfaceCMSBlock

func (*DefaultCMSBlock) Delete

func (it *DefaultCMSBlock) Delete() error

Delete removes current cms block from DB

func (*DefaultCMSBlock) EvaluateContent

func (it *DefaultCMSBlock) EvaluateContent() string

EvaluateContent applying GO text template to content value

func (*DefaultCMSBlock) FromHashMap

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

FromHashMap represents object as map[string]interface{}

func (*DefaultCMSBlock) Get

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

Get returns object attribute value or nil

func (*DefaultCMSBlock) GetAttributesInfo

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

GetAttributesInfo returns information about object attributes

func (*DefaultCMSBlock) GetCollection

func (it *DefaultCMSBlock) GetCollection() models.InterfaceCollection

GetCollection returns collection of current instance type

func (*DefaultCMSBlock) GetContent

func (it *DefaultCMSBlock) GetContent() string

GetContent returns cms block content

func (*DefaultCMSBlock) GetID

func (it *DefaultCMSBlock) GetID() string

GetID returns id for cms block

func (*DefaultCMSBlock) GetIdentifier

func (it *DefaultCMSBlock) GetIdentifier() string

GetIdentifier returns cms block identifier

func (*DefaultCMSBlock) GetImplementationName

func (it *DefaultCMSBlock) GetImplementationName() string

GetImplementationName returns model implementation name

func (*DefaultCMSBlock) GetModelName

func (it *DefaultCMSBlock) GetModelName() string

GetModelName returns model name

func (*DefaultCMSBlock) Load

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

Load loads cms block information from DB

func (*DefaultCMSBlock) LoadByIdentifier

func (it *DefaultCMSBlock) LoadByIdentifier(identifier string) error

LoadByIdentifier loads data of CMSBlock by its identifier

func (*DefaultCMSBlock) New

New returns new instance of model implementation object

func (*DefaultCMSBlock) Save

func (it *DefaultCMSBlock) Save() error

Save stores current cms block to DB

func (*DefaultCMSBlock) Set

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

Set sets attribute value to object or returns error

func (*DefaultCMSBlock) SetContent

func (it *DefaultCMSBlock) SetContent(newValue string) error

SetContent sets cms block content value

func (*DefaultCMSBlock) SetID

func (it *DefaultCMSBlock) SetID(newID string) error

SetID sets id for cms block

func (*DefaultCMSBlock) SetIdentifier

func (it *DefaultCMSBlock) SetIdentifier(newValue string) error

SetIdentifier sets csm block identifier value

func (*DefaultCMSBlock) ToHashMap

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

ToHashMap fills object attributes from map[string]interface{}

type DefaultCMSBlockCollection

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

DefaultCMSBlockCollection is a default implementer of InterfaceCMSBlockCollection

func (*DefaultCMSBlockCollection) GetDBCollection

func (it *DefaultCMSBlockCollection) GetDBCollection() db.InterfaceDBCollection

GetDBCollection returns database collection

func (*DefaultCMSBlockCollection) GetImplementationName

func (it *DefaultCMSBlockCollection) GetImplementationName() string

GetImplementationName returns model implementation name

func (*DefaultCMSBlockCollection) GetModelName

func (it *DefaultCMSBlockCollection) GetModelName() string

GetModelName returns model name

func (*DefaultCMSBlockCollection) List

List enumerates items of CMS block model

func (*DefaultCMSBlockCollection) ListAddExtraAttribute

func (it *DefaultCMSBlockCollection) ListAddExtraAttribute(attribute string) error

ListAddExtraAttribute allows to obtain additional attributes from List() function

func (*DefaultCMSBlockCollection) ListCMSBlocks

func (it *DefaultCMSBlockCollection) ListCMSBlocks() []cms.InterfaceCMSBlock

ListCMSBlocks returns list of cms block model items

func (*DefaultCMSBlockCollection) ListFilterAdd

func (it *DefaultCMSBlockCollection) ListFilterAdd(Attribute string, Operator string, Value interface{}) error

ListFilterAdd adds selection filter to List() function

func (*DefaultCMSBlockCollection) ListFilterReset

func (it *DefaultCMSBlockCollection) ListFilterReset() error

ListFilterReset clears presets made by ListFilterAdd() and ListAddExtraAttribute() functions

func (*DefaultCMSBlockCollection) ListLimit

func (it *DefaultCMSBlockCollection) ListLimit(offset int, limit int) error

ListLimit sets select pagination

func (*DefaultCMSBlockCollection) New

New returns new instance of model implementation object

Jump to

Keyboard shortcuts

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