cmsstore

package module
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: AGPL-3.0 Imports: 18 Imported by: 1

README

Cms Store Open in Gitpod

Tests Status Go Report Card PkgGoDev

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPL-3.0). You can find a copy of the license at https://www.gnu.org/licenses/agpl-3.0.en.html

For commercial use, please use my contact page to obtain a commercial license.

Introduction

This package allows to build user interfaces based on blocks.

Installation

go get -u github.com/gouniverse/cmsstore

Documentation

Index

Constants

View Source
const BLOCK_STATUS_ACTIVE = "active"
View Source
const BLOCK_STATUS_DRAFT = "draft"
View Source
const BLOCK_STATUS_INACTIVE = "inactive"
View Source
const COLUMN_ALIAS = "alias"
View Source
const COLUMN_CANONICAL_URL = "canonical_url"
View Source
const COLUMN_CONTENT = "content"
View Source
const COLUMN_CREATED_AT = "created_at"
View Source
const COLUMN_DOMAIN_NAMES = "domain_names"
View Source
const COLUMN_EDITOR = "editor"
View Source
const COLUMN_HANDLE = "handle"
View Source
const COLUMN_ID = "id"
View Source
const COLUMN_MEMO = "memo"
View Source
const COLUMN_MENU_ID = "menu_id"
View Source
const COLUMN_METAS = "metas"
View Source
const COLUMN_META_DESCRIPTION = "meta_description"
View Source
const COLUMN_META_KEYWORDS = "meta_keywords"
View Source
const COLUMN_META_ROBOTS = "meta_robots"
View Source
const COLUMN_NAME = "name"
View Source
const COLUMN_PAGE_ID = "page_id"
View Source
const COLUMN_PARENT_ID = "parent_id"
View Source
const COLUMN_SEQUENCE = "sequence"
View Source
const COLUMN_SITE_ID = "site_id"
View Source
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
View Source
const COLUMN_STATUS = "status"
View Source
const COLUMN_TARGET = "target"
View Source
const COLUMN_TEMPLATE_ID = "template_id"
View Source
const COLUMN_TITLE = "title"
View Source
const COLUMN_TYPE = "type"
View Source
const COLUMN_UPDATED_AT = "updated_at"
View Source
const COLUMN_URL = "url"
View Source
const ERROR_EMPTY_ARRAY = "array cannot be empty"
View Source
const ERROR_EMPTY_STRING = "string cannot be empty"
View Source
const ERROR_NEGATIVE_NUMBER = "number cannot be negative"
View Source
const MENU_ITEM_STATUS_ACTIVE = "active"
View Source
const MENU_ITEM_STATUS_DRAFT = "draft"
View Source
const MENU_ITEM_STATUS_INACTIVE = "inactive"
View Source
const MENU_STATUS_ACTIVE = "active"
View Source
const MENU_STATUS_DRAFT = "draft"
View Source
const MENU_STATUS_INACTIVE = "inactive"
View Source
const PAGE_EDITOR_BLOCKAREA = "blockarea"
View Source
const PAGE_EDITOR_BLOCKEDITOR = "blockeditor"
View Source
const PAGE_EDITOR_CODEMIRROR = "codemirror"
View Source
const PAGE_EDITOR_HTMLAREA = "htmlarea"
View Source
const PAGE_EDITOR_MARKDOWN = "markdown"
View Source
const PAGE_EDITOR_TEXTAREA = "textarea"
View Source
const PAGE_STATUS_ACTIVE = "active"
View Source
const PAGE_STATUS_DRAFT = "draft"
View Source
const PAGE_STATUS_INACTIVE = "inactive"
View Source
const SITE_STATUS_ACTIVE = "active"
View Source
const SITE_STATUS_DRAFT = "draft"
View Source
const SITE_STATUS_INACTIVE = "inactive"
View Source
const TEMPLATE_STATUS_ACTIVE = "active"
View Source
const TEMPLATE_STATUS_DRAFT = "draft"
View Source
const TEMPLATE_STATUS_INACTIVE = "inactive"
View Source
const VERSIONING_TYPE_BLOCK = "block"
View Source
const VERSIONING_TYPE_PAGE = "page"
View Source
const VERSIONING_TYPE_SITE = "site"
View Source
const VERSIONING_TYPE_TEMPLATE = "template"
View Source
const VERSIONING_TYPE_TRANSLATION = "translation"

Variables

This section is empty.

Functions

func NewBlockFromExistingData added in v0.2.0

func NewBlockFromExistingData(data map[string]string) *block

func NewMenuFromExistingData added in v0.10.0

func NewMenuFromExistingData(data map[string]string) *menu

func NewMenuItemFromExistingData added in v0.10.0

func NewMenuItemFromExistingData(data map[string]string) *menuItem

func NewPageFromExistingData added in v0.1.0

func NewPageFromExistingData(data map[string]string) *page

func NewSiteFromExistingData added in v0.2.1

func NewSiteFromExistingData(data map[string]string) *site

func NewTemplateFromExistingData added in v0.2.0

func NewTemplateFromExistingData(data map[string]string) *template

func NewTranslationFromExistingData added in v0.9.0

func NewTranslationFromExistingData(data map[string]string) *translation

Types

type BlockInterface added in v0.2.0

type BlockInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	ID() string
	SetID(id string) BlockInterface

	CreatedAt() string
	SetCreatedAt(createdAt string) BlockInterface
	CreatedAtCarbon() carbon.Carbon

	Content() string
	SetContent(content string) BlockInterface

	Editor() string
	SetEditor(editor string) BlockInterface

	Handle() string
	SetHandle(handle string) BlockInterface

	Memo() string
	SetMemo(memo string) BlockInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) BlockInterface

	PageID() string
	SetPageID(pageID string) BlockInterface

	ParentID() string
	SetParentID(parentID string) BlockInterface

	Sequence() string
	SequenceInt() int
	SetSequenceInt(sequence int) BlockInterface
	SetSequence(sequence string) BlockInterface

	SiteID() string
	SetSiteID(siteID string) BlockInterface

	TemplateID() string
	SetTemplateID(templateID string) BlockInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) BlockInterface
	SoftDeletedAtCarbon() carbon.Carbon

	// Status returns the status of the block, i.e. BLOCK_STATUS_ACTIVE
	Status() string

	// SetStatus sets the status of the block, i.e. BLOCK_STATUS_ACTIVE
	SetStatus(status string) BlockInterface

	// Type returns the type of the block, i.e. "text"
	Type() string

	// SetType sets the type of the block, i.e. "text"
	SetType(blockType string) BlockInterface

	// UpdatedAt returns the last updated time of block
	UpdatedAt() string

	// SetUpdatedAt sets the last updated time of block
	SetUpdatedAt(updatedAt string) BlockInterface

	// UpdatedAtCarbon returns carbon.Carbon of the last updated time of block
	UpdatedAtCarbon() carbon.Carbon

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewBlock added in v0.2.0

func NewBlock() BlockInterface

type BlockQueryInterface added in v0.2.1

type BlockQueryInterface interface {
	Validate() error

	IsCountOnly() bool

	Columns() []string
	SetColumns(columns []string) BlockQueryInterface

	HasCreatedAtGte() bool
	HasCreatedAtLte() bool
	HasHandle() bool
	HasID() bool
	HasIDIn() bool
	HasLimit() bool
	HasNameLike() bool
	HasOffset() bool
	HasOrderBy() bool
	HasPageID() bool
	HasParentID() bool
	HasSequence() bool
	HasSiteID() bool
	HasSoftDeleted() bool
	HasSortOrder() bool
	HasStatus() bool
	HasStatusIn() bool
	HasTemplateID() bool

	CreatedAtGte() string
	CreatedAtLte() string
	Handle() string
	ID() string
	IDIn() []string
	Limit() int
	NameLike() string
	Offset() int
	OrderBy() string
	PageID() string
	ParentID() string
	Sequence() int
	SiteID() string
	SoftDeleteIncluded() bool
	SortOrder() string
	Status() string
	StatusIn() []string
	TemplateID() string

	SetCountOnly(countOnly bool) BlockQueryInterface
	SetID(id string) BlockQueryInterface
	SetIDIn(idIn []string) BlockQueryInterface
	SetHandle(handle string) BlockQueryInterface
	SetLimit(limit int) BlockQueryInterface
	SetNameLike(nameLike string) BlockQueryInterface
	SetOffset(offset int) BlockQueryInterface
	SetOrderBy(orderBy string) BlockQueryInterface
	SetPageID(pageID string) BlockQueryInterface
	SetParentID(parentID string) BlockQueryInterface
	SetSequence(sequence int) BlockQueryInterface
	SetSiteID(websiteID string) BlockQueryInterface
	SetSoftDeleteIncluded(withSoftDeleted bool) BlockQueryInterface
	SetSortOrder(sortOrder string) BlockQueryInterface
	SetStatus(status string) BlockQueryInterface
	SetStatusIn(statusIn []string) BlockQueryInterface
	SetTemplateID(templateID string) BlockQueryInterface
}

func BlockQuery added in v0.5.0

func BlockQuery() BlockQueryInterface
type MenuInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	CreatedAt() string
	SetCreatedAt(createdAt string) MenuInterface
	CreatedAtCarbon() carbon.Carbon

	Handle() string
	SetHandle(handle string) MenuInterface

	ID() string
	SetID(id string) MenuInterface

	Memo() string
	SetMemo(memo string) MenuInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) MenuInterface

	SiteID() string
	SetSiteID(siteID string) MenuInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) MenuInterface
	SoftDeletedAtCarbon() carbon.Carbon

	Status() string
	SetStatus(status string) MenuInterface

	UpdatedAt() string
	SetUpdatedAt(updatedAt string) MenuInterface
	UpdatedAtCarbon() carbon.Carbon

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewMenu added in v0.10.0

func NewMenu() MenuInterface
type MenuItemInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	CreatedAt() string
	SetCreatedAt(createdAt string) MenuItemInterface
	CreatedAtCarbon() carbon.Carbon

	Handle() string
	SetHandle(handle string) MenuItemInterface

	ID() string
	SetID(id string) MenuItemInterface

	Memo() string
	SetMemo(memo string) MenuItemInterface

	MenuID() string
	SetMenuID(menuID string) MenuItemInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) MenuItemInterface

	PageID() string
	SetPageID(pageID string) MenuItemInterface

	ParentID() string
	SetParentID(parentID string) MenuItemInterface

	Sequence() string
	SequenceInt() int
	SetSequence(sequence string) MenuItemInterface
	SetSequenceInt(sequence int) MenuItemInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) MenuItemInterface
	SoftDeletedAtCarbon() carbon.Carbon

	Status() string
	SetStatus(status string) MenuItemInterface

	Target() string
	SetTarget(target string) MenuItemInterface

	UpdatedAt() string
	SetUpdatedAt(updatedAt string) MenuItemInterface
	UpdatedAtCarbon() carbon.Carbon

	URL() string
	SetURL(url string) MenuItemInterface

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewMenuItem added in v0.10.0

func NewMenuItem() MenuItemInterface
type MenuItemQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) MenuItemQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) MenuItemQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) MenuItemQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) MenuItemQueryInterface

	HasID() bool
	ID() string
	SetID(id string) MenuItemQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) MenuItemQueryInterface

	HasMenuID() bool
	MenuID() string
	SetMenuID(menuID string) MenuItemQueryInterface

	HasNameLike() bool
	NameLike() string
	SetNameLike(nameLike string) MenuItemQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) MenuItemQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) MenuItemQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) MenuItemQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) MenuItemQueryInterface

	HasSiteID() bool
	SiteID() string
	SetSiteID(siteID string) MenuItemQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(includeSoftDeleted bool) MenuItemQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) MenuItemQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) MenuItemQueryInterface
}
func MenuItemQuery() MenuItemQueryInterface
type MenuQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) MenuQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) MenuQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) MenuQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) MenuQueryInterface

	HasHandle() bool
	Handle() string
	SetHandle(handle string) MenuQueryInterface

	HasID() bool
	ID() string
	SetID(id string) MenuQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) MenuQueryInterface

	HasNameLike() bool
	NameLike() string
	SetNameLike(nameLike string) MenuQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) MenuQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) MenuQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) MenuQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) MenuQueryInterface

	HasSiteID() bool
	SiteID() string
	SetSiteID(siteID string) MenuQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(includeSoftDeleted bool) MenuQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) MenuQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) MenuQueryInterface
}
func MenuQuery() MenuQueryInterface

type NewStoreOptions added in v0.1.0

type NewStoreOptions struct {
	// Context is the context used if the AutoMigrateEnabled option is true
	// If not set, a background context is used
	Context context.Context

	// DB is the database connection
	DB *sql.DB

	// DbDriverName is the database driver name
	// If not set, an attempt will be made to detect it
	DbDriverName string

	// AutomigrateEnabled enables automigrate
	AutomigrateEnabled bool

	// DebugEnabled enables debug
	DebugEnabled bool

	// BlockTableName is the name of the block database table to be created/used
	BlockTableName string

	// MenusEnabled enables menus
	MenusEnabled bool

	// MenuTableName is the name of the menu database table to be created/used
	MenuTableName string

	// MenuItemTableName is the name of the menu item database table to be created/used
	MenuItemTableName string

	// PageTableName is the name of the page database table to be created/used
	PageTableName string

	// SiteTableName is the name of the site database table to be created/used
	SiteTableName string

	TemplateTableName string

	// TranslationsEnabled enables translations
	TranslationsEnabled bool

	// TranslationTableName is the name of the translation database table to be created/used
	TranslationTableName string

	// TranslationLanguageDefault is the default language, i.e en
	TranslationLanguageDefault string

	// TranslationLanguages is the list of supported languages
	TranslationLanguages map[string]string

	// VersioningEnabled enables versioning
	VersioningEnabled bool

	// VersioningTableName is the name of the versioning database table to be created/used
	VersioningTableName string
}

NewStoreOptions define the options for creating a new block store

type Option added in v0.16.0

type Option func(*Options)

func WithContext added in v0.16.0

func WithContext(ctx context.Context) Option

func WithDryRun added in v0.16.0

func WithDryRun(dryRun bool) Option

func WithTransaction added in v0.16.0

func WithTransaction(tx *sql.Tx) Option

type Options added in v0.16.0

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

type PageInterface added in v0.1.0

type PageInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	MarshalToVersioning() (string, error)

	ID() string
	SetID(id string) PageInterface

	Alias() string
	SetAlias(alias string) PageInterface

	CreatedAt() string
	SetCreatedAt(createdAt string) PageInterface
	CreatedAtCarbon() carbon.Carbon

	CanonicalUrl() string
	SetCanonicalUrl(canonicalUrl string) PageInterface

	Content() string
	SetContent(content string) PageInterface

	Editor() string
	SetEditor(editor string) PageInterface

	Handle() string
	SetHandle(handle string) PageInterface

	Memo() string
	SetMemo(memo string) PageInterface

	MetaDescription() string
	SetMetaDescription(metaDescription string) PageInterface

	MetaKeywords() string
	SetMetaKeywords(metaKeywords string) PageInterface

	MetaRobots() string
	SetMetaRobots(metaRobots string) PageInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) PageInterface

	SiteID() string
	SetSiteID(siteID string) PageInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) PageInterface
	SoftDeletedAtCarbon() carbon.Carbon

	Status() string
	SetStatus(status string) PageInterface

	Title() string
	SetTitle(title string) PageInterface

	TemplateID() string
	SetTemplateID(templateID string) PageInterface

	UpdatedAt() string
	SetUpdatedAt(updatedAt string) PageInterface
	UpdatedAtCarbon() carbon.Carbon

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewPage added in v0.1.0

func NewPage() PageInterface

type PageQueryInterface added in v0.1.0

type PageQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) PageQueryInterface

	HasAlias() bool
	Alias() string
	SetAlias(alias string) PageQueryInterface

	HasAliasLike() bool
	AliasLike() string
	SetAliasLike(nameLike string) PageQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) PageQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) PageQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) PageQueryInterface

	HasHandle() bool
	Handle() string
	SetHandle(handle string) PageQueryInterface

	HasID() bool
	ID() string
	SetID(id string) PageQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) PageQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) PageQueryInterface

	HasNameLike() bool
	NameLike() string
	SetNameLike(nameLike string) PageQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) PageQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) PageQueryInterface

	HasSiteID() bool
	SiteID() string
	SetSiteID(siteID string) PageQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) PageQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(softDeleteIncluded bool) PageQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) PageQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) PageQueryInterface

	HasTemplateID() bool
	TemplateID() string
	SetTemplateID(templateID string) PageQueryInterface
}

func PageQuery added in v0.5.0

func PageQuery() PageQueryInterface

type ShortcodeInterface added in v0.6.0

type ShortcodeInterface interface {
	Alias() string
	Description() string
	Render(r *http.Request, s string, m map[string]string) string
}

type SiteInterface added in v0.2.1

type SiteInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	CreatedAt() string
	SetCreatedAt(createdAt string) SiteInterface
	CreatedAtCarbon() carbon.Carbon

	DomainNames() ([]string, error)
	SetDomainNames(domainNames []string) (SiteInterface, error)

	Handle() string
	SetHandle(handle string) SiteInterface

	ID() string
	SetID(id string) SiteInterface

	Memo() string
	SetMemo(memo string) SiteInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) SiteInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) SiteInterface
	SoftDeletedAtCarbon() carbon.Carbon

	Status() string
	SetStatus(status string) SiteInterface

	UpdatedAt() string
	SetUpdatedAt(updatedAt string) SiteInterface
	UpdatedAtCarbon() carbon.Carbon

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewSite added in v0.2.1

func NewSite() SiteInterface

type SiteQueryInterface added in v0.2.1

type SiteQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) SiteQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) SiteQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) SiteQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) SiteQueryInterface

	HasDomainName() bool
	DomainName() string
	SetDomainName(domainName string) SiteQueryInterface

	HasHandle() bool
	Handle() string
	SetHandle(handle string) SiteQueryInterface

	HasID() bool
	ID() string
	SetID(id string) SiteQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) SiteQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) SiteQueryInterface

	HasNameLike() bool
	NameLike() string
	SetNameLike(nameLike string) SiteQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) SiteQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) SiteQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) SiteQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(softDeletedIncluded bool) SiteQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) SiteQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) SiteQueryInterface
}

func SiteQuery added in v0.5.0

func SiteQuery() SiteQueryInterface

type SiteQueryOptions added in v0.2.1

type SiteQueryOptions struct {
	ID           string
	IDIn         []string
	Handle       string
	NameLike     string
	Status       string
	StatusIn     []string
	CreatedAtGte string
	CreatedAtLte string
	Offset       int
	Limit        int
	SortOrder    string
	OrderBy      string
	CountOnly    bool
	WithDeleted  bool
}

type StoreInterface added in v0.1.0

type StoreInterface interface {
	AutoMigrate(ctx context.Context, opts ...Option) error
	EnableDebug(debug bool)

	BlockCreate(block BlockInterface) error
	BlockCount(options BlockQueryInterface) (int64, error)
	BlockDelete(block BlockInterface) error
	BlockDeleteByID(id string) error
	BlockFindByHandle(blockHandle string) (BlockInterface, error)
	BlockFindByID(blockID string) (BlockInterface, error)
	BlockList(query BlockQueryInterface) ([]BlockInterface, error)
	BlockSoftDelete(block BlockInterface) error
	BlockSoftDeleteByID(id string) error
	BlockUpdate(block BlockInterface) error

	MenusEnabled() bool

	MenuCreate(menu MenuInterface) error
	MenuCount(options MenuQueryInterface) (int64, error)
	MenuDelete(menu MenuInterface) error
	MenuDeleteByID(id string) error
	MenuFindByHandle(menuHandle string) (MenuInterface, error)
	MenuFindByID(menuID string) (MenuInterface, error)
	MenuList(query MenuQueryInterface) ([]MenuInterface, error)
	MenuSoftDelete(menu MenuInterface) error
	MenuSoftDeleteByID(id string) error
	MenuUpdate(menu MenuInterface) error

	MenuItemCreate(menuItem MenuItemInterface) error
	MenuItemCount(options MenuItemQueryInterface) (int64, error)
	MenuItemDelete(menuItem MenuItemInterface) error
	MenuItemDeleteByID(id string) error
	MenuItemFindByID(menuItemID string) (MenuItemInterface, error)
	MenuItemList(query MenuItemQueryInterface) ([]MenuItemInterface, error)
	MenuItemSoftDelete(menuItem MenuItemInterface) error
	MenuItemSoftDeleteByID(id string) error
	MenuItemUpdate(menuItem MenuItemInterface) error

	PageCreate(page PageInterface) error
	PageCount(options PageQueryInterface) (int64, error)
	PageDelete(page PageInterface) error
	PageDeleteByID(id string) error
	PageFindByHandle(pageHandle string) (PageInterface, error)
	PageFindByID(pageID string) (PageInterface, error)
	PageList(query PageQueryInterface) ([]PageInterface, error)
	PageSoftDelete(page PageInterface) error
	PageSoftDeleteByID(id string) error
	PageUpdate(page PageInterface) error

	SiteCreate(site SiteInterface) error
	SiteCount(options SiteQueryInterface) (int64, error)
	SiteDelete(site SiteInterface) error
	SiteDeleteByID(id string) error
	SiteFindByDomainName(siteDomainName string) (SiteInterface, error)
	SiteFindByHandle(siteHandle string) (SiteInterface, error)
	SiteFindByID(siteID string) (SiteInterface, error)
	SiteList(query SiteQueryInterface) ([]SiteInterface, error)
	SiteSoftDelete(site SiteInterface) error
	SiteSoftDeleteByID(id string) error
	SiteUpdate(site SiteInterface) error

	TemplateCreate(template TemplateInterface) error
	TemplateCount(options TemplateQueryInterface) (int64, error)
	TemplateDelete(template TemplateInterface) error
	TemplateDeleteByID(id string) error
	TemplateFindByHandle(templateHandle string) (TemplateInterface, error)
	TemplateFindByID(templateID string) (TemplateInterface, error)
	TemplateList(query TemplateQueryInterface) ([]TemplateInterface, error)
	TemplateSoftDelete(template TemplateInterface) error
	TemplateSoftDeleteByID(id string) error
	TemplateUpdate(template TemplateInterface) error

	TranslationsEnabled() bool

	TranslationCreate(translation TranslationInterface) error
	TranslationCount(options TranslationQueryInterface) (int64, error)
	TranslationDelete(translation TranslationInterface) error
	TranslationDeleteByID(id string) error
	TranslationFindByHandle(translationHandle string) (TranslationInterface, error)
	TranslationFindByID(translationID string) (TranslationInterface, error)
	TranslationList(query TranslationQueryInterface) ([]TranslationInterface, error)
	TranslationSoftDelete(translation TranslationInterface) error
	TranslationSoftDeleteByID(id string) error
	TranslationUpdate(translation TranslationInterface) error
	TranslationLanguageDefault() string
	TranslationLanguages() map[string]string

	// Versioning
	VersioningEnabled() bool
	VersioningCreate(versioning VersioningInterface) error
	// VersioningCount(options VersioningQueryInterface) (int64, error)
	VersioningDelete(versioning VersioningInterface) error
	VersioningDeleteByID(id string) error
	VersioningFindByID(versioningID string) (VersioningInterface, error)
	VersioningList(query VersioningQueryInterface) ([]VersioningInterface, error)
	VersioningSoftDelete(versioning VersioningInterface) error
	VersioningSoftDeleteByID(id string) error
	VersioningUpdate(versioning VersioningInterface) error
}

func NewStore added in v0.1.0

func NewStore(opts NewStoreOptions) (StoreInterface, error)

NewStore creates a new block store

type TemplateInterface added in v0.2.0

type TemplateInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	ID() string
	SetID(id string) TemplateInterface

	CreatedAt() string
	SetCreatedAt(createdAt string) TemplateInterface
	CreatedAtCarbon() carbon.Carbon

	Content() string
	SetContent(content string) TemplateInterface

	Editor() string
	SetEditor(editor string) TemplateInterface

	Handle() string
	SetHandle(handle string) TemplateInterface

	Memo() string
	SetMemo(memo string) TemplateInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) TemplateInterface

	SiteID() string
	SetSiteID(siteID string) TemplateInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) TemplateInterface
	SoftDeletedAtCarbon() carbon.Carbon

	Status() string
	SetStatus(status string) TemplateInterface

	UpdatedAt() string
	SetUpdatedAt(updatedAt string) TemplateInterface
	UpdatedAtCarbon() carbon.Carbon

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewTemplate added in v0.2.0

func NewTemplate() TemplateInterface

type TemplateQueryInterface added in v0.2.1

type TemplateQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) TemplateQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) TemplateQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) TemplateQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) TemplateQueryInterface

	HasHandle() bool
	Handle() string
	SetHandle(handle string) TemplateQueryInterface

	HasID() bool
	ID() string
	SetID(id string) TemplateQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) TemplateQueryInterface

	HasNameLike() bool
	NameLike() string
	SetNameLike(nameLike string) TemplateQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) TemplateQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) TemplateQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) TemplateQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) TemplateQueryInterface

	HasSiteID() bool
	SiteID() string
	SetSiteID(siteID string) TemplateQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(includeSoftDeleted bool) TemplateQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) TemplateQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) TemplateQueryInterface
}

func TemplateQuery added in v0.5.0

func TemplateQuery() TemplateQueryInterface

type TranslationInterface added in v0.9.0

type TranslationInterface interface {
	Data() map[string]string
	DataChanged() map[string]string
	MarkAsNotDirty()

	ID() string
	SetID(id string) TranslationInterface

	CreatedAt() string
	SetCreatedAt(createdAt string) TranslationInterface
	CreatedAtCarbon() carbon.Carbon

	Content() (languageCodeContent map[string]string, err error)
	SetContent(languageCodeContent map[string]string) error

	Handle() string
	SetHandle(handle string) TranslationInterface

	Memo() string
	SetMemo(memo string) TranslationInterface

	Meta(key string) string
	SetMeta(key, value string) error
	Metas() (map[string]string, error)
	SetMetas(metas map[string]string) error
	UpsertMetas(metas map[string]string) error

	Name() string
	SetName(name string) TranslationInterface

	SiteID() string
	SetSiteID(siteID string) TranslationInterface

	SoftDeletedAt() string
	SetSoftDeletedAt(softDeletedAt string) TranslationInterface
	SoftDeletedAtCarbon() carbon.Carbon

	Status() string
	SetStatus(status string) TranslationInterface

	UpdatedAt() string
	SetUpdatedAt(updatedAt string) TranslationInterface
	UpdatedAtCarbon() carbon.Carbon

	IsActive() bool
	IsInactive() bool
	IsSoftDeleted() bool
}

func NewTranslation added in v0.9.0

func NewTranslation() TranslationInterface

type TranslationQueryInterface added in v0.9.0

type TranslationQueryInterface interface {
	Validate() error

	Columns() []string
	SetColumns(columns []string) TranslationQueryInterface

	HasCountOnly() bool
	IsCountOnly() bool
	SetCountOnly(countOnly bool) TranslationQueryInterface

	HasCreatedAtGte() bool
	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) TranslationQueryInterface

	HasCreatedAtLte() bool
	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) TranslationQueryInterface

	HasHandle() bool
	Handle() string
	SetHandle(handle string) TranslationQueryInterface

	HasID() bool
	ID() string
	SetID(id string) TranslationQueryInterface

	HasIDIn() bool
	IDIn() []string
	SetIDIn(idIn []string) TranslationQueryInterface

	HasNameLike() bool
	NameLike() string
	SetNameLike(nameLike string) TranslationQueryInterface

	HasOffset() bool
	Offset() int
	SetOffset(offset int) TranslationQueryInterface

	HasLimit() bool
	Limit() int
	SetLimit(limit int) TranslationQueryInterface

	HasSortOrder() bool
	SortOrder() string
	SetSortOrder(sortOrder string) TranslationQueryInterface

	HasOrderBy() bool
	OrderBy() string
	SetOrderBy(orderBy string) TranslationQueryInterface

	HasSiteID() bool
	SiteID() string
	SetSiteID(siteID string) TranslationQueryInterface

	HasSoftDeletedIncluded() bool
	SoftDeletedIncluded() bool
	SetSoftDeletedIncluded(includeSoftDeleted bool) TranslationQueryInterface

	HasStatus() bool
	Status() string
	SetStatus(status string) TranslationQueryInterface

	HasStatusIn() bool
	StatusIn() []string
	SetStatusIn(statusIn []string) TranslationQueryInterface
}

func TranslationQuery added in v0.9.0

func TranslationQuery() TranslationQueryInterface

type VersioningInterface added in v0.16.0

type VersioningInterface interface {
	versionstore.VersionInterface
}

func NewVersioning added in v0.16.0

func NewVersioning() VersioningInterface

type VersioningQueryInterface added in v0.16.0

type VersioningQueryInterface interface {
	versionstore.VersionQueryInterface
}

func NewVersioningQuery added in v0.16.0

func NewVersioningQuery() VersioningQueryInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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