Documentation ¶
Overview ¶
Package store implements the handling of websites, groups and stores.
Usage
m := store.NewManager(options ...)
Index ¶
- Constants
- Variables
- func ValidateStoreCode(c string) error
- type Code
- type CodeRetriever
- type Group
- type GroupOption
- type GroupSlice
- type ID
- type Manager
- func (sm *Manager) ClearCache(clearAll ...bool)
- func (sm *Manager) DefaultStoreView() (*Store, error)
- func (sm *Manager) GetRequestStore(r Retriever, scopeType config.ScopeID) (*Store, error)
- func (sm *Manager) Group(r ...Retriever) (*Group, error)
- func (sm *Manager) Groups() (GroupSlice, error)
- func (sm *Manager) HasSingleStore() bool
- func (sm *Manager) Init(scopeCode Retriever, scopeType config.ScopeID) error
- func (sm *Manager) InitByRequest(res http.ResponseWriter, req *http.Request, scopeType config.ScopeID) (*Store, error)
- func (sm *Manager) InitByToken(t *jwt.Token, scopeType config.ScopeID) (*Store, error)
- func (sm *Manager) IsCacheEmpty() bool
- func (sm *Manager) IsSingleStoreMode() bool
- func (sm *Manager) ReInit(dbrSess dbr.SessionRunner, cbs ...csdb.DbrSelectCb) error
- func (sm *Manager) Store(r ...Retriever) (*Store, error)
- func (sm *Manager) Stores() (StoreSlice, error)
- func (sm *Manager) Website(r ...Retriever) (*Website, error)
- func (sm *Manager) Websites() (WebsiteSlice, error)
- type ManagerOption
- type Retriever
- type Storage
- func (st *Storage) DefaultStoreView() (*Store, error)
- func (st *Storage) Group(id Retriever) (*Group, error)
- func (st *Storage) Groups() (GroupSlice, error)
- func (st *Storage) ReInit(dbrSess dbr.SessionRunner, cbs ...csdb.DbrSelectCb) error
- func (st *Storage) Store(r Retriever) (*Store, error)
- func (st *Storage) Stores() (StoreSlice, error)
- func (st *Storage) Website(r Retriever) (*Website, error)
- func (st *Storage) Websites() (WebsiteSlice, error)
- type StorageOption
- type Storager
- type Store
- func (s *Store) AddClaim(t *jwt.Token)
- func (s *Store) AllowedCurrencies() []string
- func (s *Store) ApplyOptions(opts ...StoreOption) *Store
- func (s *Store) BaseURL(ut config.URLType, isSecure bool) string
- func (s *Store) ConfigString(path ...string) string
- func (s *Store) CurrentCurrency() *directory.Currency
- func (s *Store) Data() *TableStore
- func (s *Store) DeleteCookie(res http.ResponseWriter)
- func (s *Store) Group() *Group
- func (s *Store) ID() int64
- func (s *Store) NewCookie() *http.Cookie
- func (s *Store) Path() string
- func (s *Store) RootCategoryId() int64
- func (s *Store) SetCookie(res http.ResponseWriter)
- func (s *Store) Website() *Website
- type StoreOption
- type StoreSlice
- func (s StoreSlice) Codes() utils.StringSlice
- func (s StoreSlice) Filter(f func(*Store) bool) StoreSlice
- func (s StoreSlice) IDs() utils.Int64Slice
- func (s StoreSlice) LastItem() *Store
- func (ss StoreSlice) Len() int
- func (ss *StoreSlice) Less(i, j int) bool
- func (ss *StoreSlice) Sort() *StoreSlice
- func (ss *StoreSlice) Swap(i, j int)
- type Website
- func (w *Website) ApplyOptions(opts ...WebsiteOption)
- func (w *Website) BaseCurrency() directory.Currency
- func (w *Website) BaseCurrencyCode() (language.Currency, error)
- func (w *Website) ConfigString(path ...string) string
- func (w *Website) Data() *TableWebsite
- func (w *Website) DefaultGroup() (*Group, error)
- func (w *Website) DefaultStore() (*Store, error)
- func (w *Website) Groups() (GroupSlice, error)
- func (w *Website) ID() int64
- func (w *Website) SetGroupsStores(tgs TableGroupSlice, tss TableStoreSlice) *Website
- func (w *Website) Stores() (StoreSlice, error)
- type WebsiteOption
- type WebsiteSlice
- func (ws WebsiteSlice) Codes() utils.StringSlice
- func (ws WebsiteSlice) Filter(f func(*Website) bool) WebsiteSlice
- func (ws WebsiteSlice) IDs() utils.Int64Slice
- func (ws WebsiteSlice) Len() int
- func (ws *WebsiteSlice) Less(i, j int) bool
- func (ws *WebsiteSlice) Sort() *WebsiteSlice
- func (ws *WebsiteSlice) Swap(i, j int)
Constants ¶
const ( // SingleStoreModeEnabled if true then single store mode enabled // This flag only shows that admin does not want to show certain // UI components in the backend (like store switchers etc) // If there is only one store view but it does not check the store view collection. WTF? PathSingleStoreModeEnabled = "general/single_store_mode/enabled" PathStoreStoreName = "general/store_information/name" PathStoreStorePhone = "general/store_information/phone" PathStoreInURL = "web/url/use_store" PathStoreRedirectToBase = "web/url/redirect_to_base" PathSecureInFrontend = "web/secure/use_in_frontend" PathUnsecureBaseURL = "web/unsecure/base_url" PathSecureBaseURL = "web/secure/base_url" PathSecureBaseStaticURL = "web/secure/base_static_url" PathUnsecureBaseStaticURL = "web/unsecure/base_static_url" PathSecureBaseMediaURL = "web/secure/base_media_url" PathUnsecureBaseMediaURL = "web/unsecure/base_media_url" // This defines the base currency scope ("Currency Setup" > "Currency Options" > "Base Currency"). // can be 0 = Global or 1 = Website PathPriceScope = "catalog/price/scope" PlaceholderBaseURL = config.LeftDelim + "base_url" + config.RightDelim PlaceholderBaseURLSecure = config.LeftDelim + "secure_base_url" + config.RightDelim PlaceholderBaseURLUnSecure = config.LeftDelim + "unsecure_base_url" + config.RightDelim )
const ( // DefaultStoreID is always 0. DefaultStoreID int64 = 0 // HTTPRequestParamStore name of the GET parameter to set a new store in a current website/group context HTTPRequestParamStore = `___store` // CookieName important when the user selects a different store within the current website/group context. // This cookie permanently saves the new selected store code for one year. // The cookie must be removed when the default store of the current website if equal to the current store. CookieName = `store` // PriceScopeGlobal prices are for all stores and websites the same. PriceScopeGlobal = `0` // must be string // PriceScopeWebsite prices are in each website different. PriceScopeWebsite = `1` // must be string )
const ( // DefaultGroupID defines the default group id which is always 0. DefaultGroupID int64 = 0 )
const ( // DefaultWebsiteID is always 0 DefaultWebsiteID int64 = 0 )
Variables ¶
var ( // ErrGroupNotFound when the group has not been found. ErrGroupNotFound = errors.New("Group not found") // ErrGroupStoresNotAvailable not really an error but more an info when the stores has not been set // this usually occurs when the group has been set on a website or a store. ErrGroupStoresNotAvailable = errors.New("Group stores not available") // ErrGroupDefaultStoreNotFound default store cannot be found. ErrGroupDefaultStoreNotFound = errors.New("Group default store not found") // ErrGroupWebsiteNotFound the Website struct is nil so we cannot assign the stores to a group. ErrGroupWebsiteNotFound = errors.New("Group Website not found or nil or ID do not match") )
var ( ErrUnsupportedScopeID = errors.New("Unsupported scope id") ErrStoreChangeNotAllowed = errors.New("Store change not allowed") ErrAppStoreNotSet = errors.New("AppStore is not initialized") ErrAppStoreSet = errors.New("AppStore already initialized") ErrHashRetrieverNil = errors.New("Hash argument is nil") )
var ( ErrStoreNotFound = errors.New("Store not found") ErrStoreNotActive = errors.New("Store not active") ErrStoreNewArgNil = errors.New("An argument cannot be nil") ErrStoreIncorrectGroup = errors.New("Incorrect group") ErrStoreIncorrectWebsite = errors.New("Incorrect website") ErrStoreCodeInvalid = errors.New("The store code may contain only letters (a-z), numbers (0-9) or underscore(_). The first character must be a letter") )
var ( // ErrWebsiteNotFound when the website has not been found within a slice ErrWebsiteNotFound = errors.New("Website not found") // ErrWebsiteDefaultGroupNotFound the default group cannot be found ErrWebsiteDefaultGroupNotFound = errors.New("Website Default Group not found") // ErrWebsiteGroupsNotAvailable Groups are in the current context not available and nil ErrWebsiteGroupsNotAvailable = errors.New("Website Groups not available") // ErrWebsiteStoresNotAvailable Stores are in the current context not available and nil ErrWebsiteStoresNotAvailable = errors.New("Website Stores not available") )
var PackageConfiguration config.SectionSlice
PackageConfiguration contains the main configuration
var TableCollection csdb.TableStructureSlice
TableCollection handles all tables and its columns. init() in generated Go file will set the value.
Functions ¶
func ValidateStoreCode ¶
ValidateStoreCode checks if a store code is valid. Returns an ErrStoreCodeInvalid if the first letter is not a-zA-Z and followed by a-zA-Z0-9_ or store code length is greater than 32 characters.
Types ¶
type Code ¶
type Code string
Code is convenience helper to satisfy the interface CodeRetriever and IDRetriever.
type CodeRetriever ¶
type CodeRetriever interface {
Code() string
}
CodeRetriever implements how to get an object by Code which can be website or store code. Groups doesn't have codes.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group contains two maps for faster retrieving of the store index and the store collection Only used in generated code. Implements interface GroupGetter.
func NewGroup ¶
func NewGroup(tg *TableGroup, opts ...GroupOption) *Group
NewGroup returns a new pointer to a Group. If a Website has been provided the config.Reader will be set to the Website.
func (*Group) ApplyOptions ¶
func (g *Group) ApplyOptions(opts ...GroupOption) *Group
ApplyOptions sets the options to a Group.
func (*Group) Data ¶
func (g *Group) Data() *TableGroup
Data returns the TableGroup data which is raw database data.
func (*Group) DefaultStore ¶
DefaultStore returns the default Store or an error.
func (*Group) SetStores ¶
SetStores uses the full store collection to extract the stores which are assigned to a group. Either Website must be set before calling SetStores() or the second argument must be set i.e. 2nd argument can be nil. Panics if both values are nil. If both are set, the 2nd argument will be considered.
func (*Group) Stores ¶
func (g *Group) Stores() (StoreSlice, error)
Stores returns all stores associated to a group or an error if stores are not available.
type GroupOption ¶
type GroupOption func(*Group)
func SetGroupConfig ¶
func SetGroupConfig(cr config.Reader) GroupOption
SetGroupConfig sets the configuration Reader to the Group. Default reader is config.DefaultManager
func SetGroupWebsite ¶
func SetGroupWebsite(tw *TableWebsite) GroupOption
SetGroupWebsite sets the website to a group.
type GroupSlice ¶
type GroupSlice []*Group
GroupSlice collection of Group. GroupSlice has some nice method receivers.
func (GroupSlice) Filter ¶
func (s GroupSlice) Filter(f func(*Group) bool) GroupSlice
Filter returns a new slice filtered by predicate f
func (GroupSlice) IDs ¶
func (s GroupSlice) IDs() utils.Int64Slice
IDs returns an Int64Slice with all store ids
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager uses three internal maps to cache the pointers of Website, Group and Store.
func NewManager ¶
func NewManager(opts ...ManagerOption) *Manager
NewManager creates a new store manager which handles websites, store groups and stores. @todo Default Storager should be a hardcoded Table* struct ...
func (*Manager) ClearCache ¶
ClearCache resets the internal caches which stores the pointers to a Website, Group or Store and all related slices. Please use with caution. ReInit() also uses this method. Providing argument true clears also the internal appStore cache.
func (*Manager) DefaultStoreView ¶
DefaultStoreView returns the default store view.
func (*Manager) GetRequestStore ¶
GetRequestStore is in Magento named setCurrentStore and only used by InitByRequest(). First argument is the store ID or store code, 2nd arg the scope from the init process. Also prevents running a store from another website or store group, if website or store group was specified explicitly. It returns either an error or the new Store. The returning errors can get ignored because if a Store Code is invalid the parent calling function must fall back to the appStore. This function must be used within an RPC handler.
func (*Manager) Group ¶
Group returns a cached Group which contains all related stores and its website. Only the argument ID is supported. If no argument has been supplied then the Group of the internal appStore will be returned. If more than one argument has been provided it returns an error.
func (*Manager) Groups ¶
func (sm *Manager) Groups() (GroupSlice, error)
Groups returns a cached slice containing all pointers to Groups with its associated stores and websites. It panics when the integrity is incorrect.
func (*Manager) HasSingleStore ¶
HasSingleStore checks if we only have one store view besides the admin store view. Mostly used in models to the set store id and in blocks to not display the store switch.
func (*Manager) Init ¶
Init initializes the appStore from a scope code and a scope type. This function is mainly used when booting the app to set the environment configuration Also all other calls to any method receiver with nil arguments depends on the appStore. @see \Magento\Store\Model\StorageFactory::_reinitStores
func (*Manager) InitByRequest ¶
func (sm *Manager) InitByRequest(res http.ResponseWriter, req *http.Request, scopeType config.ScopeID) (*Store, error)
InitByRequest returns a new Store read from a cookie or HTTP request param. The internal appStore must be set before hand. 1. check cookie store, always a string and the store code 2. check for ___store variable, always a string and the store code 3. May return nil,nil if nothing is set. This function must be used within an HTTP handler. The returned new Store must be used in the HTTP context and overrides the appStore. @see \Magento\Store\Model\StorageFactory::_reinitStores
func (*Manager) InitByToken ¶
InitByToken returns a Store pointer from a JSON web token. If the store code is invalid, this function can return nil,nil
func (*Manager) IsCacheEmpty ¶
IsCacheEmpty returns true if the internal cache is empty.
func (*Manager) IsSingleStoreMode ¶
IsSingleStoreMode check if Single-Store mode is enabled in configuration and from Store count < 3. This flag only shows that admin does not want to show certain UI components at backend (like store switchers etc) if Magento has only one store view but it does not check the store view collection.
func (*Manager) ReInit ¶
func (sm *Manager) ReInit(dbrSess dbr.SessionRunner, cbs ...csdb.DbrSelectCb) error
ReInit reloads the website, store group and store view data from the database. After reloading internal cache will be cleared if there are no errors.
func (*Manager) Store ¶
Store returns the cached Store view containing its group and its website. If ID and code are available then the non-empty code has precedence. If no argument has been supplied then the appStore will be returned. If more than one argument has been provided it returns an error.
func (*Manager) Stores ¶
func (sm *Manager) Stores() (StoreSlice, error)
Stores returns a cached Store slice. Can return an error when the website or the group cannot be found.
func (*Manager) Website ¶
Website returns the cached Website pointer from an ID or code including all of its groups and all related stores. It panics when the integrity is incorrect. If ID and code are available then the non-empty code has precedence. If no argument has been supplied then the Website of the internal appStore will be returned. If more than one argument has been provided it returns an error.
func (*Manager) Websites ¶
func (sm *Manager) Websites() (WebsiteSlice, error)
Websites returns a cached slice containing all pointers to Websites with its associated groups and stores. It panics when the integrity is incorrect.
type ManagerOption ¶
type ManagerOption func(*Manager)
ManagerOption option func for NewManager()
func NewStorageOption ¶
func NewStorageOption(opts ...StorageOption) ManagerOption
NewStorageOption sames as NewStorage() but returns a function to be used in NewManager()
func SetManagerConfig ¶
func SetManagerConfig(cr config.Reader) ManagerOption
SetManagerConfig sets the configuration Reader. Optional. Default reader is config.DefaultManager
func SetManagerStorage ¶
func SetManagerStorage(s Storager) ManagerOption
SetStorage sets the underlying storage system to the Manager. Required option.
type Retriever ¶
type Retriever interface {
ID() int64
}
Retriever implements how to get the ID. If Retriever implements CodeRetriever then CodeRetriever has precedence. ID can be any of the website, group or store IDs.
func GetCodeFromClaim ¶
func GetCodeFromClaim(t *jwt.Token) Retriever
Global functions
GetClaim returns a valid store code from a JSON web token or nil
func GetCodeFromCookie ¶
GetCookie returns from a Request the value of the store cookie or nil.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage contains a mutex and the raw slices from the database. @todo maybe make private?
func NewStorage ¶
func NewStorage(opts ...StorageOption) *Storage
NewStorage creates a new storage object from three slice types. All three arguments can be nil but then you call ReInit()
func (*Storage) DefaultStoreView ¶
DefaultStoreView traverses through the websites to find the default website and gets the default group which has the default store id assigned to. Only one website can be the default one.
func (*Storage) Group ¶
Group creates a new Group which contains all related stores and its website according to the interface definition.
func (*Storage) Groups ¶
func (st *Storage) Groups() (GroupSlice, error)
Groups creates a new group slice containing its website all related stores. May panic when a website pointer is nil.
func (*Storage) ReInit ¶
func (st *Storage) ReInit(dbrSess dbr.SessionRunner, cbs ...csdb.DbrSelectCb) error
ReInit reloads all websites, groups and stores concurrently from the database. If GOMAXPROCS is set to > 1 then in parallel. Returns an error with location or nil. If an error occurs then all internal slices will be reset.
func (*Storage) Store ¶
Store creates a new Store which contains the the store, its group and website according to the interface definition.
func (*Storage) Stores ¶
func (st *Storage) Stores() (StoreSlice, error)
Stores creates a new store slice. Can return an error when the website or the group cannot be found.
func (*Storage) Websites ¶
func (st *Storage) Websites() (WebsiteSlice, error)
Websites creates a slice of Website pointers according to the interface definition.
type StorageOption ¶
type StorageOption func(*Storage)
StorageOption option func for NewStorage()
func SetStorageConfig ¶
func SetStorageConfig(cr config.Reader) StorageOption
SetStorageConfig sets the configuration Reader. Optional. Default reader is config.DefaultManager
func SetStorageGroups ¶
func SetStorageGroups(tgs ...*TableGroup) StorageOption
SetStorageGroups adds the TableGroupSlice to the Storage. By default, the slice is nil.
func SetStorageStores ¶
func SetStorageStores(tss ...*TableStore) StorageOption
SetStorageStores adds the TableStoreSlice to the Storage. By default, the slice is nil.
func SetStorageWebsites ¶
func SetStorageWebsites(tws ...*TableWebsite) StorageOption
SetStorageWebsites adds the TableWebsiteSlice to the Storage. By default, the slice is nil.
type Storager ¶
type Storager interface { // Website creates a new Website pointer from an ID or code including all of its // groups and all related stores. It panics when the integrity is incorrect. // If ID and code are available then the non-empty code has precedence. Website(Retriever) (*Website, error) // Websites creates a slice containing all pointers to Websites with its associated // groups and stores. It panics when the integrity is incorrect. Websites() (WebsiteSlice, error) // Group creates a new Group which contains all related stores and its website. // Only the argument ID can be used to get a specific Group. Group(Retriever) (*Group, error) // Groups creates a slice containing all pointers to Groups with its associated // stores and websites. It panics when the integrity is incorrect. Groups() (GroupSlice, error) // Store creates a new Store containing its group and its website. // If ID and code are available then the non-empty code has precedence. Store(Retriever) (*Store, error) // Stores creates a new store slice. Can return an error when the website or // the group cannot be found. Stores() (StoreSlice, error) // DefaultStoreView traverses through the websites to find the default website and gets // the default group which has the default store id assigned to. Only one website can be the default one. DefaultStoreView() (*Store, error) // ReInit reloads the websites, groups and stores from the database. ReInit(dbr.SessionRunner, ...csdb.DbrSelectCb) error }
Storager implements the requirements to get new websites, groups and store views. This interface is used in the StoreManager
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store contains two maps for faster retrieving of the store index and the store collection Only used in generated code. Implements interface StoreGetter.
func NewStore ¶
func NewStore(ts *TableStore, tw *TableWebsite, tg *TableGroup, opts ...StoreOption) *Store
NewStore returns a new pointer to a Store. Panics if TableGroup and TableWebsite have not been provided Panics if integrity checks fail. config.Reader will be set to Group and Website.
func (*Store) AddClaim ¶
func (s *Store) AddClaim(t *jwt.Token)
AddClaim adds the store code to a JSON web token
func (*Store) AllowedCurrencies ¶
AllowedCurrencies returns all installed currencies from global scope.
func (*Store) ApplyOptions ¶
func (s *Store) ApplyOptions(opts ...StoreOption) *Store
ApplyOptions sets the options to the Store struct.
func (*Store) BaseURL ¶
BaseUrl returns the path from the URL or config where CoreStore is installed @todo @see https://github.com/magento/magento2/blob/0.74.0-beta7/app/code/Magento/Store/Model/Store.php#L539
func (*Store) ConfigString ¶
ConfigString tries to get a value from the scopeStore if empty falls back to default global scope. If using etcd or consul maybe this can lead to round trip times because of network access.
func (*Store) CurrentCurrency ¶
CurrentCurrency @todo @see app/code/Magento/Store/Model/Store.php::getCurrentCurrency
func (*Store) Data ¶
func (s *Store) Data() *TableStore
Data returns the real store data from the database
func (*Store) DeleteCookie ¶
func (s *Store) DeleteCookie(res http.ResponseWriter)
DeleteCookie deletes the store cookie
func (*Store) ID ¶
ID satisfies the interface Retriever and mainly used in the StoreManager for selecting Website,Group ...
func (*Store) NewCookie ¶
NewCookie creates a new pre-configured cookie. @todo create cookie manager to stick to the limits of http://www.ietf.org/rfc/rfc2109.txt page 15 @see http://browsercookielimits.squawky.net/
func (*Store) RootCategoryId ¶
RootCategoryId returns the root category ID assigned to this store view.
func (*Store) SetCookie ¶
func (s *Store) SetCookie(res http.ResponseWriter)
SetCookie adds a cookie which contains the store code and is valid for one year.
type StoreOption ¶
type StoreOption func(s *Store)
StoreOption option func for NewStore()
func SetStoreConfig ¶
func SetStoreConfig(cr config.Reader) StoreOption
SetStoreConfig sets the config.Reader to the Store. Default reader is config.DefaultManager
type StoreSlice ¶
type StoreSlice []*Store
StoreSlice a collection of pointers to the Store structs. StoreSlice has some nifty method receviers.
func (StoreSlice) Codes ¶
func (s StoreSlice) Codes() utils.StringSlice
Codes returns a StringSlice with all store codes
func (StoreSlice) Filter ¶
func (s StoreSlice) Filter(f func(*Store) bool) StoreSlice
Filter returns a new slice filtered by predicate f
func (StoreSlice) IDs ¶
func (s StoreSlice) IDs() utils.Int64Slice
IDs returns an Int64Slice with all store ids
func (StoreSlice) LastItem ¶
func (s StoreSlice) LastItem() *Store
LastItem returns the last item of this slice or nil
func (StoreSlice) Len ¶
func (ss StoreSlice) Len() int
func (*StoreSlice) Less ¶
func (ss *StoreSlice) Less(i, j int) bool
func (*StoreSlice) Swap ¶
func (ss *StoreSlice) Swap(i, j int)
type Website ¶
type Website struct {
// contains filtered or unexported fields
}
Website contains two maps for faster retrieving of the store index and the store collection Only used in generated code. Implements interface WebsiteGetter.
func NewWebsite ¶
func NewWebsite(tw *TableWebsite, opts ...WebsiteOption) *Website
NewWebsite returns a new pointer to a Website.
func (*Website) ApplyOptions ¶
func (w *Website) ApplyOptions(opts ...WebsiteOption)
ApplyOptions sets the options on a Website
func (*Website) BaseCurrencyCode ¶
@todo
func (*Website) ConfigString ¶
ConfigString tries to get a value from the scopeStore if empty falls back to default global scope. If using etcd or consul maybe this can lead to round trip times because of network access.
func (*Website) Data ¶
func (w *Website) Data() *TableWebsite
Data returns the data from the database
func (*Website) DefaultGroup ¶
DefaultGroup returns the default Group or an error if not found
func (*Website) DefaultStore ¶
DefaultStore returns the default store which via the default group.
func (*Website) Groups ¶
func (w *Website) Groups() (GroupSlice, error)
Groups returns all groups associated to this website or an error when the groups are not available aka not needed.
func (*Website) ID ¶
ID satisfies the interface Retriever and mainly used in the StoreManager for selecting Website,Group ...
func (*Website) SetGroupsStores ¶
SetGroupsStores uses a group slice and a table slice to set the groups associated to this website and the stores associated to this website. It panics if the integrity is incorrect.
func (*Website) Stores ¶
func (w *Website) Stores() (StoreSlice, error)
Stores returns all stores associated to this website or an error when the stores are not available aka not needed.
type WebsiteOption ¶
type WebsiteOption func(*Website)
WebsiteOption option func for NewWebsite()
func SetWebsiteConfig ¶
func SetWebsiteConfig(cr config.Reader) WebsiteOption
SetWebsiteConfig sets the config.Reader to the Website. Default reader is config.DefaultManager
type WebsiteSlice ¶
type WebsiteSlice []*Website
WebsiteSlice contains pointer to Website struct and some nifty method receivers.
func (WebsiteSlice) Codes ¶
func (ws WebsiteSlice) Codes() utils.StringSlice
Codes returns a StringSlice with all website codes
func (WebsiteSlice) Filter ¶
func (ws WebsiteSlice) Filter(f func(*Website) bool) WebsiteSlice
Filter returns a new slice filtered by predicate f
func (WebsiteSlice) IDs ¶
func (ws WebsiteSlice) IDs() utils.Int64Slice
IDs returns an Int64Slice with all website ids
func (WebsiteSlice) Len ¶
func (ws WebsiteSlice) Len() int
func (*WebsiteSlice) Less ¶
func (ws *WebsiteSlice) Less(i, j int) bool
func (*WebsiteSlice) Swap ¶
func (ws *WebsiteSlice) Swap(i, j int)