Documentation ¶
Index ¶
- Constants
- func Slug(s string) string
- type Cache
- type CacheMenuNodeRepository
- func (r CacheMenuNodeRepository) DeleteByID(ctx context.Context, id uuid.UUID) error
- func (r CacheMenuNodeRepository) FindByID(ctx context.Context, id uuid.UUID) (node *MenuNode, err error)
- func (r CacheMenuNodeRepository) FindByMenuIDAndDate(ctx context.Context, menuID uuid.UUID, date time.Time) (nodes []*MenuNode, err error)
- func (r CacheMenuNodeRepository) Save(ctx context.Context, menuNode *MenuNode) error
- type CacheMenuRepository
- func (r CacheMenuRepository) DeleteByID(ctx context.Context, id uuid.UUID) error
- func (r CacheMenuRepository) FindByID(ctx context.Context, id uuid.UUID) (menu *Menu, err error)
- func (r CacheMenuRepository) FindByIdentifierAndDate(ctx context.Context, identifier string, date time.Time) (menu *Menu, err error)
- func (r CacheMenuRepository) Save(ctx context.Context, menu *Menu) error
- type CachePageRepository
- func (r CachePageRepository) DeleteByID(ctx context.Context, id uuid.UUID) error
- func (r CachePageRepository) FindByID(ctx context.Context, id uuid.UUID) (page *Page, err error)
- func (r CachePageRepository) FindByParentIDAndDate(ctx context.Context, parentID uuid.UUID, date time.Time) (pages []*Page, err error)
- func (r CachePageRepository) FindByPathAndDate(ctx context.Context, path string, date time.Time) (page *Page, err error)
- func (r CachePageRepository) Save(ctx context.Context, page *Page) error
- type Menu
- type MenuNode
- type MenuNodeRepository
- type MenuRepository
- type Meta
- type MetaType
- type NodeTarget
- type NodeType
- type Page
- type PageRepository
- type Service
Constants ¶
View Source
const ( SelfNodeTarget NodeTarget = "_self" BlankNodeTarget NodeTarget = "_blank" PageType NodeType = "page" CustomType NodeType = "custom" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CacheMenuNodeRepository ¶
type CacheMenuNodeRepository struct { MenuNodeRepository Cache Cache }
func (CacheMenuNodeRepository) DeleteByID ¶
func (CacheMenuNodeRepository) FindByMenuIDAndDate ¶
type CacheMenuRepository ¶
type CacheMenuRepository struct { MenuRepository Cache Cache }
func (CacheMenuRepository) DeleteByID ¶
func (CacheMenuRepository) FindByIdentifierAndDate ¶
type CachePageRepository ¶
type CachePageRepository struct { PageRepository Cache Cache }
func (CachePageRepository) DeleteByID ¶
func (CachePageRepository) FindByParentIDAndDate ¶
func (CachePageRepository) FindByPathAndDate ¶
type Menu ¶
type Menu struct { ID uuid.UUID `cfg:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" bson:"id,omitempty"` Identifier string `cfg:"identifier,omitempty" json:"identifier,omitempty" yaml:"identifier,omitempty" bson:"identifier,omitempty"` Created time.Time `cfg:"created,omitempty" json:"created,omitempty" yaml:"created,omitempty" bson:"created,omitempty"` Updated time.Time `cfg:"updated,omitempty" json:"updated,omitempty" yaml:"updated,omitempty" bson:"updated,omitempty"` Published *time.Time `cfg:"published,omitempty" json:"published,omitempty" yaml:"published,omitempty" bson:"published,omitempty"` Expired *time.Time `cfg:"expired,omitempty" json:"expired,omitempty" yaml:"expired,omitempty" bson:"expired,omitempty"` Nodes []*MenuNode `cfg:"nodes,omitempty" json:"nodes,omitempty" yaml:"nodes,omitempty" bson:"nodes,omitempty"` Metadata map[string]interface{} `cfg:"metadata,omitempty" json:"metadata,omitempty" yaml:"metadata,omitempty" bson:"metadata,omitempty"` }
type MenuNode ¶
type MenuNode struct { ID uuid.UUID `cfg:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" bson:"id,omitempty"` ParentID *uuid.UUID `cfg:"parent_id,omitempty" json:"parent_id,omitempty" yaml:"parent_id,omitempty" bson:"parent_id,omitempty"` Parent *MenuNode `cfg:"parent,omitempty" json:"parent,omitempty" yaml:"parent,omitempty" bson:"-"` Children []*MenuNode `cfg:"children,omitempty" json:"children,omitempty" yaml:"children,omitempty" bson:"-"` MenuID uuid.UUID `cfg:"menu_id,omitempty" json:"menu_id,omitempty" yaml:"menu_id,omitempty" bson:"menu_id,omitempty"` Menu *Menu `cfg:"menu,omitempty" json:"menu,omitempty" yaml:"menu,omitempty" bson:"-"` PageID *uuid.UUID `cfg:"page_id,omitempty" json:"page_id,omitempty" yaml:"page_id,omitempty" bson:"page_id,omitempty"` Title string `cfg:"title,omitempty" json:"title,omitempty" yaml:"title,omitempty" bson:"title,omitempty"` URL string `cfg:"url,omitempty" json:"url,omitempty" yaml:"url,omitempty" bson:"url,omitempty"` Target NodeTarget `cfg:"target,omitempty" json:"target,omitempty" yaml:"target,omitempty" bson:"target,omitempty"` NodeType NodeType `cfg:"node_type,omitempty" json:"node_type,omitempty" yaml:"node_type,omitempty" bson:"node_type,omitempty"` Position int `cfg:"position" json:"position,omitempty" yaml:"position,omitempty" bson:"position,omitempty"` Metadata map[string]interface{} `cfg:"metadata,omitempty" json:"metadata,omitempty" yaml:"metadata,omitempty" bson:"metadata,omitempty"` Created time.Time `cfg:"created,omitempty" json:"created,omitempty" yaml:"created,omitempty" bson:"created,omitempty"` Updated time.Time `cfg:"updated,omitempty" json:"updated,omitempty" yaml:"updated,omitempty" bson:"updated,omitempty"` Published *time.Time `cfg:"published,omitempty" json:"published,omitempty" yaml:"published,omitempty" bson:"published,omitempty"` Expired *time.Time `cfg:"expired,omitempty" json:"expired,omitempty" yaml:"expired,omitempty" bson:"expired,omitempty"` }
func FirstActiveMenuNode ¶
func LastActiveMenuNode ¶
func (*MenuNode) ActiveChild ¶
type MenuNodeRepository ¶
type MenuNodeRepository interface { Find(ctx context.Context, criteria *cr.Criteria) ([]*MenuNode, int, error) FindByID(ctx context.Context, id uuid.UUID) (*MenuNode, error) FindByMenuIDAndDate(ctx context.Context, menuID uuid.UUID, date time.Time) ([]*MenuNode, error) DeleteByID(ctx context.Context, id uuid.UUID) error Save(ctx context.Context, menuNode *MenuNode) error }
type MenuRepository ¶
type MenuRepository interface { Find(ctx context.Context, criteria *cr.Criteria) ([]*Menu, int, error) FindByID(ctx context.Context, id uuid.UUID) (*Menu, error) FindByIdentifierAndDate(ctx context.Context, identifier string, date time.Time) (*Menu, error) DeleteByID(ctx context.Context, id uuid.UUID) error Save(ctx context.Context, menu *Menu) error }
type Meta ¶
type Meta struct { Type MetaType `cfg:"type" json:"type,omitempty" yaml:"type,omitempty" bson:"type,omitempty"` Key string `cfg:"key" json:"key,omitempty" yaml:"key,omitempty" bson:"key,omitempty"` Content string `cfg:"content" json:"content,omitempty" yaml:"content,omitempty" bson:"content,omitempty"` }
type NodeTarget ¶
type NodeTarget string
type Page ¶
type Page struct { ID uuid.UUID `cfg:"id,omitempty" json:"id,omitempty" yaml:"id,omitempty" bson:"id,omitempty"` Path string `cfg:"path,omitempty" json:"path,omitempty" yaml:"path,omitempty" bson:"path,omitempty"` Title string `cfg:"title,omitempty" json:"title,omitempty" yaml:"title,omitempty" bson:"title,omitempty"` Template string `cfg:"template,omitempty" json:"template,omitempty" yaml:"template,omitempty" bson:"template,omitempty"` NoSitemap bool `cfg:"no_sitemap,omitempty" json:"no_sitemap,omitempty" yaml:"no_sitemap,omitempty" bson:"no_sitemap,omitempty"` Created time.Time `cfg:"created,omitempty" json:"created,omitempty" yaml:"created,omitempty" bson:"created,omitempty"` Updated time.Time `cfg:"updated,omitempty" json:"updated,omitempty" yaml:"updated,omitempty" bson:"updated,omitempty"` Published *time.Time `cfg:"published,omitempty" json:"published,omitempty" yaml:"published,omitempty" bson:"published,omitempty"` Expired *time.Time `cfg:"expired,omitempty" json:"expired,omitempty" yaml:"expired,omitempty" bson:"expired,omitempty"` Metas []Meta `cfg:"metas,omitempty" json:"metas,omitempty" yaml:"metas,omitempty" bson:"metas,omitempty"` Metadata map[string]interface{} `cfg:"metadata,omitempty" json:"metadata,omitempty" yaml:"metadata,omitempty" bson:"metadata,omitempty"` ParentID *uuid.UUID `cfg:"parent_id,omitempty" json:"parent_id,omitempty" yaml:"parent_id,omitempty" bson:"parent_id,omitempty"` Parent *Page `cfg:"parent,omitempty" json:"parent,omitempty" yaml:"parent,omitempty" bson:"-"` Children []*Page `cfg:"children,omitempty" json:"children,omitempty" yaml:"children,omitempty" bson:"-"` }
type PageRepository ¶
type PageRepository interface { Find(ctx context.Context, criteria *cr.Criteria) ([]*Page, int, error) FindByID(ctx context.Context, id uuid.UUID) (*Page, error) FindByPathAndDate(ctx context.Context, path string, date time.Time) (*Page, error) FindByParentIDAndDate(ctx context.Context, parentID uuid.UUID, date time.Time) ([]*Page, error) DeleteByID(ctx context.Context, id uuid.UUID) error Save(ctx context.Context, page *Page) error }
type Service ¶
type Service interface { GetPage(ctx context.Context, path string, date time.Time) (*Page, error) GetPages(ctx context.Context, parentID uuid.UUID, date time.Time) ([]*Page, error) GetMenu(ctx context.Context, identifier string, date time.Time) (*Menu, error) }
func NewService ¶
func NewService(page PageRepository, menu MenuRepository, menuNode MenuNodeRepository) Service
Click to show internal directories.
Click to hide internal directories.