cmsstore

package module
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

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

All of the existing GoLang CMSs require a full installations from scratch. Its impossible to just add them to an exiting Go application, and even when added feel like you don't get what you hoped for.

This package allows to add a content management system as a module dependency, which can be easily updated or removed as required to ANY Go app. It is fully self contained, and does not require any additional packages or dependencies. Removal is also a breeze just remove the module.

Installation

go get -u github.com/dracory/cmsstore

Features

  • Multi-site
  • Templates
  • Pages
  • Blocks
  • Menus
  • Translations
  • Custom Entity Types
  • Supports middleware
  • Supports shortcodes

MCP (Model Context Protocol)

CMS Store includes an MCP (Model Context Protocol) HTTP handler that allows LLM clients (for example Windsurf) to manage CMS content via JSON-RPC tools.

  • The MCP handler lives in the mcp package
  • It supports MCP JSON-RPC methods (initialize, tools/list, tools/call) and legacy aliases (list_tools, call_tool)
  • It exposes tools such as page_list, page_create, page_get, page_update, page_delete, menu_list, menu_create, menu_get, site_list, and cms_schema

See the detailed documentation and examples in: mcp/README.md

Simplest Initialization

The simplest initialization involves providing a database instance. Note that this minimal setup has limited capabilities; features like database migrations are not automatically run.

// Establish database connection. Replace with your actual database connection details.
db, err := mainDb(utils.Env("DB_DRIVER"), utils.Env("DB_HOST"), utils.Env("DB_PORT"), utils.Env("DB_DATABASE"), utils.Env("DB_USERNAME"), utils.Env("DB_PASSWORD"))
if err != nil {
	log.Panic("Database is NIL: " + err.Error())
	return
}
if db == nil {
	log.Panic("Database is NIL")
	return
}

// Configure store options. Customize table names as needed. All table names are prefixed with `cms_`.
opts := cmsstore.NewStoreOptions{
    DB: db,
    BlockTableName: "cms_blocks", // Name of the database table for blocks
    PageTableName: "cms_pages",   // Name of the database table for pages
    SiteTableName: "cms_sites",   // Name of the database table for sites
    TemplateTableName: "cms_templates", // Name of the database table for templates
    MenusEnabled: true,       // Enable menu functionality
    MenuTableName: "cms_menus",   // Name of the database table for menus
    MenuItemTableName: "cms_menu_items", // Name of the database table for menu items
    TranslationsEnabled: true, // Enable translation functionality
    TranslationTableName: "cms_translations", // Name of the database table for translations
    TranslationLanguageDefault: "en", // Default language code
    TranslationLanguages: map[string]string{"en": "English"}, // Supported languages
    VersioningEnabled: true,   // Enable versioning functionality
    VersioningTableName: "cms_versions", // Name of the database table for versions
}

// Create a new store instance with the specified options.
store, err := cmsstore.NewStore(opts)
if err != nil {
    log.Panic(err)
}

// Create a new CMS instance using the created store.
myCms, errCms := cms.NewCms(cms.Config{
	Store: store,
})

Shortcodes

Shortcodes provide a powerful way to inject custom complex rendering logic into your content. i.e database queries, showing lists of shop products, blog posts, etc.

This allows for highly flexible and customizable content generation, without the need to write complex templates.

Shortcodes are defined externally as part of your Go project and registered with the store during initialization.

Another advantage of shortcodes is their versioning. Because shortcodes are part of your project's standard code, they are easily version-controlled.

Defining a Shortcode:

Create a function that implements the cmsstore.ShortcodeInterface. This interface requires three methods:

  • Alias() string: Returns a unique identifier for your shortcode.
  • Description() string: Provides a brief description of the shortcode's purpose.
  • Render(r *http.Request, s string, m map[string]string) string: This method performs the actual rendering. It takes the HTTP request, the content string, and a map of parameters as input and returns the rendered string.

Registering a Shortcode:

When creating a new store using cmsstore.NewStore, pass your custom shortcode functions in the Shortcodes field of the cmsstore.NewStoreOptions struct.

Using a Shortcode:

Place your shortcode within your content using the specified delimiters (configurable via shortcode.NewShortcode). The shortcode will be rendered dynamically during content processing.

Example:

Let's say you have a shortcode named "my-shortcode" that takes a "name" parameter. You would use it in your content like this: <my-shortcode name="John Doe">. The Render method of your shortcode implementation would then process this and generate the appropriate output.

Multisite Functionality

This Content Management System (CMS) offers a robust multisite functionality, enabling you to manage multiple websites from a single installation.

Each site has its own:

  • Templates: layouts for your pages
  • Pages: individual content pages for each site
  • Blocks: reusable content blocks that can be used across multiple pages and sites, i.e. header, footer, sidebar, galleries, sliders, carousels, testimonials, FAQs, etc.
  • Menus: customizable navigation menus for each site
  • Translations: support for multiple languages

It alows you to:

  • Manage multiple brands, regions, or languages from a single installation
  • Create separate websites for specific campaigns or events
  • Easily setup different themes for each site
  • Rapidly add landing pages, tracking pages, sales funnel pages, etc.

Pages

Pages are the core content units of the CMS. They are structured using a flexible data model that allows for rich content and metadata.

Pages can be created, updated, deleted, and versioned through a dedicated admin interface.

They support various features such as custom templates, SEO metadata (keywords, descriptions, robots directives), and middleware for custom processing.

Benefits
  • Organized Content: Pages provide a structured way to organize and manage website content.
  • SEO Optimization: Built-in support for SEO metadata helps improve search engine rankings.
  • Flexible Templating: The use of templates allows for consistent design and branding across the site.
  • Version Control: Versioning capabilities allow for easy rollback to previous versions.
  • Customizable Workflows: Middleware support enables custom processing and workflows.
SEO Capabilities

Pages support various SEO features, including:

  • Meta Keywords: Specify relevant keywords for search engines.
  • Meta Descriptions: Provide concise descriptions for search results.
  • Meta Robots: Control how search engines crawl and index the page.
  • Canonical URLs: Specify the preferred URL for the page, preventing duplicate content issues.
Editors

Pages can be edited through a user-friendly admin interface. The admin interface provides tools for creating, updating, and deleting pages, as well as managing page versions. Page content can be easily managed using a variety of editors:

  • CodeMirror Editor: Raw HTML editing for advanced customization.
  • WYSIWYG Editor: Rich text editing for advanced formatting.
  • Markdown Editor: Markdown syntax for simple text formatting. TODO: Access control can be implemented to restrict editing permissions.

Templates

Templates define the layout of pages. They can be customized to create different page designs. Templates can be associated with pages, allowing for flexible and reusable designs. The system supports template versioning and management through a dedicated admin interface.

Benefits
  • Consistent Design: Templates ensure a consistent look and feel across the website.
  • Reusable Layouts: Templates allow for the creation of reusable layouts, reducing development time and effort.
  • Flexible Layouts: Templates can be customized to create various page layouts.
  • Version Control: Versioning capabilities allow for easy rollback to previous versions.

Translations

This CMS supports multilingual content through a robust translation system. Translations are managed as individual entities, allowing for efficient management and updates. Each translation is associated with a specific content item and language code. The system supports multiple languages and allows for easy switching between languages.

Benefits of Using Translations
  • Multilingual Support: Easily create and manage content in multiple languages.
  • Global Reach: Expand your reach to a wider audience by providing content in their native language.
  • Improved User Experience: Provide a more user-friendly experience by offering content in the user's preferred language.
  • Efficient Management: Manage translations efficiently through a dedicated admin interface.
Using Translations

Translations are inserted into content using placeholders of the form [[TRANSLATION_translationID]]. The frontend code then replaces these placeholders with the appropriate translated text based on the user's selected language. Administrators can manage translations through a dedicated admin interface, providing tools for creating, updating, and deleting translations. The system automatically selects the appropriate translation based on the user's language preference.

Blocks

Blocks are reusable content units that can be assembled to create pages. They provide a modular approach to content creation, allowing for flexible and dynamic page layouts. Blocks can be managed through a dedicated admin interface, allowing for easy creation, updating, and deletion. The use of blocks promotes reusability, consistency, and maintainability of website content.

Benefits of Using Blocks
  • Reusability: Create once, use many times across different pages and sites.
  • Consistency: Maintain a consistent look and feel across your website.
  • Maintainability: Easily update content in one place and have it reflected everywhere.
  • Flexibility: Create dynamic and flexible page layouts by combining different blocks.
  • Efficiency: Reduce development time and effort by reusing existing blocks.
Using Blocks

Blocks are inserted into pages using placeholders of the form [[BLOCK_blockID]]. The frontend code then replaces these placeholders with the rendered content of the corresponding block. This allows for dynamic content generation and flexible page layouts. Administrators can manage blocks through a dedicated admin interface, providing tools for creating, updating, and deleting blocks.

Menus

This CMS provides a robust menu management system, allowing you to create and manage hierarchical menus for your website. Menus are structured as trees, enabling you to organize your navigation in a clear and intuitive way. The system supports creating, updating, deleting, and filtering menus through a dedicated admin interface.

Benefits of Using Menus
  • Organized Navigation: Create clear and intuitive navigation for your website visitors.
  • Improved User Experience: Guide users easily through your website content.
  • Flexible Structure: Create hierarchical menus to reflect the structure of your website.
  • Efficient Management: Manage menus efficiently through a dedicated admin interface.
Using Menus

Menus are created and managed through the admin interface, which provides tools for creating, updating, and deleting menu items. The hierarchical structure of menus allows you to organize your navigation in a clear and intuitive way. The system supports various menu types and allows for customization of menu items.

CMS URL Patterns

The following URL patterns are supported:

  • :any - ([^/]+)
  • :num - ([0-9]+)
  • :all - (.*)
  • :string - ([a-zA-Z]+)
  • :number - ([0-9]+)
  • :numeric - ([0-9-.]+)
  • :alpha - ([a-zA-Z0-9-_]+)

Example:

/blog/:num/:any
/shop/product/:num/:any

Documentation

For more information, please refer to the Documentation.

Documentation

Overview

Package cmsstore contains the implementation of the CMS store functionality.

Package cmsstore defines the interface for querying menu items.

Package cmsstore provides the core functionality for the CMS store.

Package cmsstore provides functionality to create and manage a CMS store, handling various components like blocks, menus, pages, templates, and translations.

Index

Constants

View Source
const (
	BLOCK_STATUS_DRAFT    = "draft"
	BLOCK_STATUS_ACTIVE   = "active"
	BLOCK_STATUS_INACTIVE = "inactive"
)

Block Statuses

View Source
const (
	ERROR_EMPTY_ARRAY     = "array cannot be empty"
	ERROR_EMPTY_STRING    = "string cannot be empty"
	ERROR_NEGATIVE_NUMBER = "number cannot be negative"
)

Error Messages for Validation

View Source
const (
	COLUMN_ALIAS              = "alias"
	COLUMN_CANONICAL_URL      = "canonical_url"
	COLUMN_CONTENT            = "content"
	COLUMN_CREATED_AT         = "created_at"
	COLUMN_DOMAIN_NAMES       = "domain_names"
	COLUMN_EDITOR             = "editor"
	COLUMN_ID                 = "id"
	COLUMN_HANDLE             = "handle"
	COLUMN_MEMO               = "memo"
	COLUMN_MENU_ID            = "menu_id"
	COLUMN_META_DESCRIPTION   = "meta_description"
	COLUMN_META_KEYWORDS      = "meta_keywords"
	COLUMN_META_ROBOTS        = "meta_robots"
	COLUMN_METAS              = "metas"
	COLUMN_NAME               = "name"
	COLUMN_MIDDLEWARES_BEFORE = "middlewares_before"
	COLUMN_MIDDLEWARES_AFTER  = "middlewares_after"
	COLUMN_PAGE_ID            = "page_id"
	COLUMN_PARENT_ID          = "parent_id"
	COLUMN_SEQUENCE           = "sequence"
	COLUMN_SITE_ID            = "site_id"
	COLUMN_SOFT_DELETED_AT    = "soft_deleted_at"
	COLUMN_STATUS             = "status"
	COLUMN_TARGET             = "target"
	COLUMN_TYPE               = "type"
	COLUMN_TEMPLATE_ID        = "template_id"
	COLUMN_TITLE              = "title"
	COLUMN_UPDATED_AT         = "updated_at"
	COLUMN_URL                = "url"
)

Column Names for Database Queries

View Source
const (
	MENU_STATUS_DRAFT    = "draft"
	MENU_STATUS_ACTIVE   = "active"
	MENU_STATUS_INACTIVE = "inactive"
)

Menu Statuses

View Source
const (
	MENU_ITEM_STATUS_DRAFT    = "draft"
	MENU_ITEM_STATUS_ACTIVE   = "active"
	MENU_ITEM_STATUS_INACTIVE = "inactive"
)

Menu Item Statuses

View Source
const (
	MIDDLEWARE_TYPE_BEFORE = "before"
	MIDDLEWARE_TYPE_AFTER  = "after"
)

Middleware Types

View Source
const (
	PAGE_STATUS_DRAFT    = "draft"
	PAGE_STATUS_ACTIVE   = "active"
	PAGE_STATUS_INACTIVE = "inactive"
)

Page Statuses

View Source
const (
	PAGE_EDITOR_BLOCKAREA   = "blockarea"
	PAGE_EDITOR_BLOCKEDITOR = "blockeditor"
	PAGE_EDITOR_CODEMIRROR  = "codemirror"
	PAGE_EDITOR_HTMLAREA    = "htmlarea"
	PAGE_EDITOR_MARKDOWN    = "markdown"
	PAGE_EDITOR_TEXTAREA    = "textarea"
)

Page Editor Types

View Source
const (
	SITE_STATUS_DRAFT    = "draft"
	SITE_STATUS_ACTIVE   = "active"
	SITE_STATUS_INACTIVE = "inactive"
)

Site Statuses

View Source
const (
	TEMPLATE_STATUS_DRAFT    = "draft"
	TEMPLATE_STATUS_ACTIVE   = "active"
	TEMPLATE_STATUS_INACTIVE = "inactive"
)

Template Statuses

View Source
const (
	TRANSLATION_STATUS_DRAFT    = "draft"
	TRANSLATION_STATUS_ACTIVE   = "active"
	TRANSLATION_STATUS_INACTIVE = "inactive"
)

Translation Statuses

View Source
const (
	VERSIONING_TYPE_BLOCK       = "block"
	VERSIONING_TYPE_PAGE        = "page"
	VERSIONING_TYPE_MENU        = "menu"
	VERSIONING_TYPE_MENU_ITEM   = "menu_item"
	VERSIONING_TYPE_TEMPLATE    = "template"
	VERSIONING_TYPE_TRANSLATION = "translation"
	VERSIONING_TYPE_SITE        = "site"
)

Versioning Types

Variables

This section is empty.

Functions

func GenerateShortID added in v1.7.0

func GenerateShortID() string

GenerateShortID generates a new shortened ID using TimestampMicro + Crockford Base32 (lowercase) Returns a 9-character lowercase ID (e.g., "86ccrtsgx")

func IsShortID added in v1.7.0

func IsShortID(id string) bool

IsShortID checks if an ID appears to be a shortened ID (9 or 21 chars) vs a long HumanUid ID (32 chars)

func Middleware

func Middleware() *middleware

Middleware creates a new middleware instance.

func NewBlockFromExistingData

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

func NewMenuFromExistingData

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

NewMenuFromExistingData creates a new menu instance from existing data. It hydrates the menu with the provided data map.

func NewMenuItemFromExistingData

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

func NewPageFromExistingData

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

NewPageFromExistingData creates a new page from existing data.

func NewSiteFromExistingData

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

NewSiteFromExistingData creates a new site from existing data.

func NormalizeID added in v1.7.0

func NormalizeID(id string) string

NormalizeID normalizes an ID to lowercase for consistent lookups Handles both short (9-char, 21-char) and long (32-char) ID formats

func ShortenID added in v1.7.0

func ShortenID(id string) string

ShortenID shortens a long ID to its shortened form - 9-char IDs: Return as-is (already shortened TimestampMicro) - 32-char IDs: Shorten to 21-char using Crockford - Other lengths: Return as-is

func UnshortenID added in v1.7.0

func UnshortenID(id string) string

UnshortenID attempts to unshorten a shortened ID back to its original form Returns the original ID if it cannot be unshortened

Types

type BlockInterface

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

func NewBlock() BlockInterface

type BlockQueryInterface

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

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

	MarshalToVersioning() (string, error)

	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

func NewMenu() MenuInterface

NewMenu creates a new menu instance with default values. It initializes the menu with a unique ID, draft status, and current timestamps.

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

	MarshalToVersioning() (string, error)

	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

func NewMenuItem() MenuItemInterface

NewMenuItem creates a new menu item with default values.

type MenuItemQueryInterface interface {
	// Validate validates the query parameters.
	Validate() error

	// Columns returns the columns to be returned in the query.
	Columns() []string
	// SetColumns sets the columns to be returned in the query.
	SetColumns(columns []string) MenuItemQueryInterface

	// HasCountOnly returns true if the query is for counting only.
	HasCountOnly() bool
	// IsCountOnly returns true if the query is for counting only.
	IsCountOnly() bool
	// SetCountOnly sets the query to be for counting only.
	SetCountOnly(countOnly bool) MenuItemQueryInterface

	// HasCreatedAtGte returns true if the query has a CreatedAtGte filter.
	HasCreatedAtGte() bool
	// CreatedAtGte returns the CreatedAtGte filter.
	CreatedAtGte() string
	// SetCreatedAtGte sets the CreatedAtGte filter.
	SetCreatedAtGte(createdAtGte string) MenuItemQueryInterface

	// HasCreatedAtLte returns true if the query has a CreatedAtLte filter.
	HasCreatedAtLte() bool
	// CreatedAtLte returns the CreatedAtLte filter.
	CreatedAtLte() string
	// SetCreatedAtLte sets the CreatedAtLte filter.
	SetCreatedAtLte(createdAtLte string) MenuItemQueryInterface

	// HasID returns true if the query has an ID filter.
	HasID() bool
	// ID returns the ID filter.
	ID() string
	// SetID sets the ID filter.
	SetID(id string) MenuItemQueryInterface

	// HasIDIn returns true if the query has an IDIn filter.
	HasIDIn() bool
	// IDIn returns the IDIn filter.
	IDIn() []string
	// SetIDIn sets the IDIn filter.
	SetIDIn(idIn []string) MenuItemQueryInterface

	// HasMenuID returns true if the query has a MenuID filter.
	HasMenuID() bool
	// MenuID returns the MenuID filter.
	MenuID() string
	// SetMenuID sets the MenuID filter.
	SetMenuID(menuID string) MenuItemQueryInterface

	// HasNameLike returns true if the query has a NameLike filter.
	HasNameLike() bool
	// NameLike returns the NameLike filter.
	NameLike() string
	// SetNameLike sets the NameLike filter.
	SetNameLike(nameLike string) MenuItemQueryInterface

	// HasOffset returns true if the query has an Offset.
	HasOffset() bool
	// Offset returns the Offset.
	Offset() int
	// SetOffset sets the Offset.
	SetOffset(offset int) MenuItemQueryInterface

	// HasLimit returns true if the query has a Limit.
	HasLimit() bool
	// Limit returns the Limit.
	Limit() int
	// SetLimit sets the Limit.
	SetLimit(limit int) MenuItemQueryInterface

	// HasSortOrder returns true if the query has a SortOrder.
	HasSortOrder() bool
	// SortOrder returns the SortOrder.
	SortOrder() string
	// SetSortOrder sets the SortOrder.
	SetSortOrder(sortOrder string) MenuItemQueryInterface

	// HasOrderBy returns true if the query has an OrderBy.
	HasOrderBy() bool
	// OrderBy returns the OrderBy.
	OrderBy() string
	// SetOrderBy sets the OrderBy.
	SetOrderBy(orderBy string) MenuItemQueryInterface

	// HasSiteID returns true if the query has a SiteID filter.
	HasSiteID() bool
	// SiteID returns the SiteID filter.
	SiteID() string
	// SetSiteID sets the SiteID filter.
	SetSiteID(siteID string) MenuItemQueryInterface

	// HasSoftDeletedIncluded returns true if soft deleted items should be included.
	HasSoftDeletedIncluded() bool
	// SoftDeletedIncluded returns true if soft deleted items should be included.
	SoftDeletedIncluded() bool
	// SetSoftDeletedIncluded sets whether soft deleted items should be included.
	SetSoftDeletedIncluded(includeSoftDeleted bool) MenuItemQueryInterface

	// HasStatus returns true if the query has a Status filter.
	HasStatus() bool
	// Status returns the Status filter.
	Status() string
	// SetStatus sets the Status filter.
	SetStatus(status string) MenuItemQueryInterface

	// HasStatusIn returns true if the query has a StatusIn filter.
	HasStatusIn() bool
	// StatusIn returns the StatusIn filter.
	StatusIn() []string
	// SetStatusIn sets the StatusIn filter.
	SetStatusIn(statusIn []string) MenuItemQueryInterface
}

MenuItemQueryInterface defines the interface for querying menu items.

func MenuItemQuery() MenuItemQueryInterface

MenuItemQuery returns a new instance of MenuItemQueryInterface. It initializes the properties map to store query parameters.

type MenuQueryInterface interface {
	// Validate checks if the query parameters are valid.
	Validate() error

	// Columns returns the list of columns to be selected in the query.
	Columns() []string
	// SetColumns sets the list of columns to be selected in the query.
	SetColumns(columns []string) MenuQueryInterface

	// HasCountOnly checks if the query is set to return only the count.
	HasCountOnly() bool
	// IsCountOnly returns true if the query is set to return only the count.
	IsCountOnly() bool
	// SetCountOnly sets the query to return only the count.
	SetCountOnly(countOnly bool) MenuQueryInterface

	// HasCreatedAtGte checks if the query has a 'created_at' greater than or equal to condition.
	HasCreatedAtGte() bool
	// CreatedAtGte returns the 'created_at' greater than or equal to condition.
	CreatedAtGte() string
	// SetCreatedAtGte sets the 'created_at' greater than or equal to condition.
	SetCreatedAtGte(createdAtGte string) MenuQueryInterface

	// HasCreatedAtLte checks if the query has a 'created_at' less than or equal to condition.
	HasCreatedAtLte() bool
	// CreatedAtLte returns the 'created_at' less than or equal to condition.
	CreatedAtLte() string
	// SetCreatedAtLte sets the 'created_at' less than or equal to condition.
	SetCreatedAtLte(createdAtLte string) MenuQueryInterface

	// HasHandle checks if the query has a 'handle' condition.
	HasHandle() bool
	// Handle returns the 'handle' condition.
	Handle() string
	// SetHandle sets the 'handle' condition.
	SetHandle(handle string) MenuQueryInterface

	// HasID checks if the query has an 'id' condition.
	HasID() bool
	// ID returns the 'id' condition.
	ID() string
	// SetID sets the 'id' condition.
	SetID(id string) MenuQueryInterface

	// HasIDIn checks if the query has an 'id' in condition.
	HasIDIn() bool
	// IDIn returns the 'id' in condition.
	IDIn() []string
	// SetIDIn sets the 'id' in condition.
	SetIDIn(idIn []string) MenuQueryInterface

	// HasNameLike checks if the query has a 'name' like condition.
	HasNameLike() bool
	// NameLike returns the 'name' like condition.
	NameLike() string
	// SetNameLike sets the 'name' like condition.
	SetNameLike(nameLike string) MenuQueryInterface

	// HasOffset checks if the query has an offset condition.
	HasOffset() bool
	// Offset returns the offset condition.
	Offset() int
	// SetOffset sets the offset condition.
	SetOffset(offset int) MenuQueryInterface

	// HasLimit checks if the query has a limit condition.
	HasLimit() bool
	// Limit returns the limit condition.
	Limit() int
	// SetLimit sets the limit condition.
	SetLimit(limit int) MenuQueryInterface

	// HasSortOrder checks if the query has a sort order condition.
	HasSortOrder() bool
	// SortOrder returns the sort order condition.
	SortOrder() string
	// SetSortOrder sets the sort order condition.
	SetSortOrder(sortOrder string) MenuQueryInterface

	// HasOrderBy checks if the query has an order by condition.
	HasOrderBy() bool
	// OrderBy returns the order by condition.
	OrderBy() string
	// SetOrderBy sets the order by condition.
	SetOrderBy(orderBy string) MenuQueryInterface

	// HasSiteID checks if the query has a 'site_id' condition.
	HasSiteID() bool
	// SiteID returns the 'site_id' condition.
	SiteID() string
	// SetSiteID sets the 'site_id' condition.
	SetSiteID(siteID string) MenuQueryInterface

	// HasSoftDeletedIncluded checks if the query includes soft deleted records.
	HasSoftDeletedIncluded() bool
	// SoftDeletedIncluded returns true if the query includes soft deleted records.
	SoftDeletedIncluded() bool
	// SetSoftDeletedIncluded sets whether the query should include soft deleted records.
	SetSoftDeletedIncluded(includeSoftDeleted bool) MenuQueryInterface

	// HasStatus checks if the query has a 'status' condition.
	HasStatus() bool
	// Status returns the 'status' condition.
	Status() string
	// SetStatus sets the 'status' condition.
	SetStatus(status string) MenuQueryInterface

	// HasStatusIn checks if the query has a 'status' in condition.
	HasStatusIn() bool
	// StatusIn returns the 'status' in condition.
	StatusIn() []string
	// SetStatusIn sets the 'status' in condition.
	SetStatusIn(statusIn []string) MenuQueryInterface
}

MenuQueryInterface defines the methods required for querying menus.

func MenuQuery() MenuQueryInterface

MenuQuery returns a new instance of MenuQueryInterface.

type MiddlewareInterface

type MiddlewareInterface interface {
	// Identifier is a unique identifier for internal use (e.g., "auth_before").
	// Must be unique, and cannot be changed after creation.
	Identifier() string

	// Name is a human-friendly label for display purposes (e.g., "Authentication Middleware").
	Name() string

	// Description provides details about the middleware’s functionality.
	Description() string

	// Type specifies when the middleware is executed:
	// - "before"  → Runs before rendering page content.
	// - "after"   → Runs after rendering page content.
	Type() string

	// Handler returns the middleware function that processes HTTP requests.
	Handler() func(next http.Handler) http.Handler
}

MiddlewareInterface defines the structure of a middleware.

type NewStoreOptions

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

	// Shortcodes is a list of shortcodes to be registered
	Shortcodes []ShortcodeInterface

	// Middlewares is a list of middlewares to be registered
	Middlewares []MiddlewareInterface
}

NewStoreOptions defines the options for creating a new block store

type Option

type Option func(*Options)

Option is a function type that modifies an Options instance.

func WithContext

func WithContext(ctx context.Context) Option

WithContext sets the context for the CMS store operations.

func WithDryRun

func WithDryRun(dryRun bool) Option

WithDryRun sets the dry run flag for the CMS store operations.

func WithTransaction

func WithTransaction(tx *sql.Tx) Option

WithTransaction sets the transaction for the CMS store operations.

type Options

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

Options holds various configuration options for the CMS store operations.

type PageInterface

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

	MiddlewaresBefore() []string
	SetMiddlewaresBefore(middlewaresBefore []string) PageInterface

	MiddlewaresAfter() []string
	SetMiddlewaresAfter(middlewaresAfter []string) PageInterface

	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

func NewPage() PageInterface

NewPage creates a new page with default values.

type PageQueryInterface

type PageQueryInterface interface {
	// Validate checks if the query parameters are valid.
	Validate() error

	// Columns returns the list of columns to be queried.
	Columns() []string
	// SetColumns sets the list of columns to be queried.
	SetColumns(columns []string) PageQueryInterface

	// HasAlias checks if an alias is set.
	HasAlias() bool
	// Alias returns the alias if set.
	Alias() string
	// SetAlias sets the alias.
	SetAlias(alias string) PageQueryInterface

	// HasAliasLike checks if an alias pattern is set.
	HasAliasLike() bool
	// AliasLike returns the alias pattern if set.
	AliasLike() string
	// SetAliasLike sets the alias pattern.
	SetAliasLike(nameLike string) PageQueryInterface

	// HasCreatedAtGte checks if a 'created at' greater-than-or-equal-to filter is set.
	HasCreatedAtGte() bool
	// CreatedAtGte returns the 'created at' greater-than-or-equal-to filter if set.
	CreatedAtGte() string
	// SetCreatedAtGte sets the 'created at' greater-than-or-equal-to filter.
	SetCreatedAtGte(createdAtGte string) PageQueryInterface

	// HasCreatedAtLte checks if a 'created at' less-than-or-equal-to filter is set.
	HasCreatedAtLte() bool
	// CreatedAtLte returns the 'created at' less-than-or-equal-to filter if set.
	CreatedAtLte() string
	// SetCreatedAtLte sets the 'created at' less-than-or-equal-to filter.
	SetCreatedAtLte(createdAtLte string) PageQueryInterface

	// HasCountOnly checks if count-only mode is set.
	HasCountOnly() bool
	// IsCountOnly returns the count-only mode setting.
	IsCountOnly() bool
	// SetCountOnly sets the count-only mode.
	SetCountOnly(countOnly bool) PageQueryInterface

	// HasHandle checks if a handle is set.
	HasHandle() bool
	// Handle returns the handle if set.
	Handle() string
	// SetHandle sets the handle.
	SetHandle(handle string) PageQueryInterface

	// HasID checks if an ID is set.
	HasID() bool
	// ID returns the ID if set.
	ID() string
	// SetID sets the ID.
	SetID(id string) PageQueryInterface

	// HasIDIn checks if an ID list is set.
	HasIDIn() bool
	// IDIn returns the ID list if set.
	IDIn() []string
	// SetIDIn sets the ID list.
	SetIDIn(idIn []string) PageQueryInterface

	// HasLimit checks if a limit is set.
	HasLimit() bool
	// Limit returns the limit if set.
	Limit() int
	// SetLimit sets the limit.
	SetLimit(limit int) PageQueryInterface

	// HasNameLike checks if a name pattern is set.
	HasNameLike() bool
	// NameLike returns the name pattern if set.
	NameLike() string
	// SetNameLike sets the name pattern.
	SetNameLike(nameLike string) PageQueryInterface

	// HasOffset checks if an offset is set.
	HasOffset() bool
	// Offset returns the offset if set.
	Offset() int
	// SetOffset sets the offset.
	SetOffset(offset int) PageQueryInterface

	// HasOrderBy checks if an order-by clause is set.
	HasOrderBy() bool
	// OrderBy returns the order-by clause if set.
	OrderBy() string
	// SetOrderBy sets the order-by clause.
	SetOrderBy(orderBy string) PageQueryInterface

	// HasSiteID checks if a site ID is set.
	HasSiteID() bool
	// SiteID returns the site ID if set.
	SiteID() string
	// SetSiteID sets the site ID.
	SetSiteID(siteID string) PageQueryInterface

	// HasSortOrder checks if a sort order is set.
	HasSortOrder() bool
	// SortOrder returns the sort order if set.
	SortOrder() string
	// SetSortOrder sets the sort order.
	SetSortOrder(sortOrder string) PageQueryInterface

	// HasSoftDeletedIncluded checks if soft-deleted records are included.
	HasSoftDeletedIncluded() bool
	// SoftDeletedIncluded returns whether soft-deleted records are included.
	SoftDeletedIncluded() bool
	// SetSoftDeletedIncluded sets whether to include soft-deleted records.
	SetSoftDeletedIncluded(softDeleteIncluded bool) PageQueryInterface

	// HasStatus checks if a status is set.
	HasStatus() bool
	// Status returns the status if set.
	Status() string
	// SetStatus sets the status.
	SetStatus(status string) PageQueryInterface

	// HasStatusIn checks if a status list is set.
	HasStatusIn() bool
	// StatusIn returns the status list if set.
	StatusIn() []string
	// SetStatusIn sets the status list.
	SetStatusIn(statusIn []string) PageQueryInterface

	// HasTemplateID checks if a template ID is set.
	HasTemplateID() bool
	// TemplateID returns the template ID if set.
	TemplateID() string
	// SetTemplateID sets the template ID.
	SetTemplateID(templateID string) PageQueryInterface
}

PageQueryInterface defines methods for querying pages in the CMS store.

func PageQuery

func PageQuery() PageQueryInterface

PageQuery returns a new instance of PageQueryInterface with an initialized map to hold query parameters.

type ShortcodeInterface

type ShortcodeInterface interface {
	// Alias returns a unique identifier for the shortcode.
	Alias() string

	// Description provides a brief explanation of the shortcode's purpose and usage.
	Description() string

	// Render generates the final output of the shortcode based on the provided
	// HTTP request, shortcode name, and a map of attributes.
	// r: HTTP request containing the context in which the shortcode is rendered.
	// s: The name of the shortcode.
	// m: A map of attributes and their values that configure the shortcode behavior.
	Render(r *http.Request, s string, m map[string]string) string
}

ShortcodeInterface defines the methods that a shortcode must implement. A shortcode is a reusable snippet of code or content that can be rendered within a web page or template.

type SiteInterface

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

	MarshalToVersioning() (string, error)

	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

func NewSite() SiteInterface

NewSite creates a new site with default values.

type SiteQueryInterface

type SiteQueryInterface interface {
	// Validate checks if the query parameters are valid.
	Validate() error

	// Columns returns the list of columns to be selected in the query.
	Columns() []string
	// SetColumns sets the list of columns to be selected in the query.
	SetColumns(columns []string) SiteQueryInterface

	// HasCountOnly checks if the query is set to return only the count of records.
	HasCountOnly() bool
	// IsCountOnly returns true if the query is set to return only the count of records.
	IsCountOnly() bool
	// SetCountOnly sets the query to return only the count of records.
	SetCountOnly(countOnly bool) SiteQueryInterface

	// HasCreatedAtGte checks if the query has a 'created_at' greater than or equal to condition.
	HasCreatedAtGte() bool
	// CreatedAtGte returns the 'created_at' greater than or equal to condition.
	CreatedAtGte() string
	// SetCreatedAtGte sets the 'created_at' greater than or equal to condition.
	SetCreatedAtGte(createdAtGte string) SiteQueryInterface

	// HasCreatedAtLte checks if the query has a 'created_at' less than or equal to condition.
	HasCreatedAtLte() bool
	// CreatedAtLte returns the 'created_at' less than or equal to condition.
	CreatedAtLte() string
	// SetCreatedAtLte sets the 'created_at' less than or equal to condition.
	SetCreatedAtLte(createdAtLte string) SiteQueryInterface

	// HasDomainName checks if the query has a domain name condition.
	HasDomainName() bool
	// DomainName returns the domain name condition.
	DomainName() string
	// SetDomainName sets the domain name condition.
	SetDomainName(domainName string) SiteQueryInterface

	// HasHandle checks if the query has a handle condition.
	HasHandle() bool
	// Handle returns the handle condition.
	Handle() string
	// SetHandle sets the handle condition.
	SetHandle(handle string) SiteQueryInterface

	// HasID checks if the query has an ID condition.
	HasID() bool
	// ID returns the ID condition.
	ID() string
	// SetID sets the ID condition.
	SetID(id string) SiteQueryInterface

	// HasIDIn checks if the query has an ID in condition.
	HasIDIn() bool
	// IDIn returns the ID in condition.
	IDIn() []string
	// SetIDIn sets the ID in condition.
	SetIDIn(idIn []string) SiteQueryInterface

	// HasLimit checks if the query has a limit condition.
	HasLimit() bool
	// Limit returns the limit condition.
	Limit() int
	// SetLimit sets the limit condition.
	SetLimit(limit int) SiteQueryInterface

	// HasNameLike checks if the query has a name like condition.
	HasNameLike() bool
	// NameLike returns the name like condition.
	NameLike() string
	// SetNameLike sets the name like condition.
	SetNameLike(nameLike string) SiteQueryInterface

	// HasOffset checks if the query has an offset condition.
	HasOffset() bool
	// Offset returns the offset condition.
	Offset() int
	// SetOffset sets the offset condition.
	SetOffset(offset int) SiteQueryInterface

	// HasSortOrder checks if the query has a sort order condition.
	HasSortOrder() bool
	// SortOrder returns the sort order condition.
	SortOrder() string
	// SetSortOrder sets the sort order condition.
	SetSortOrder(sortOrder string) SiteQueryInterface

	// HasOrderBy checks if the query has an order by condition.
	HasOrderBy() bool
	// OrderBy returns the order by condition.
	OrderBy() string
	// SetOrderBy sets the order by condition.
	SetOrderBy(orderBy string) SiteQueryInterface

	// HasSoftDeletedIncluded checks if the query includes soft deleted records.
	HasSoftDeletedIncluded() bool
	// SoftDeletedIncluded returns true if the query includes soft deleted records.
	SoftDeletedIncluded() bool
	// SetSoftDeletedIncluded sets the query to include soft deleted records.
	SetSoftDeletedIncluded(softDeletedIncluded bool) SiteQueryInterface

	// HasStatus checks if the query has a status condition.
	HasStatus() bool
	// Status returns the status condition.
	Status() string
	// SetStatus sets the status condition.
	SetStatus(status string) SiteQueryInterface

	// HasStatusIn checks if the query has a status in condition.
	HasStatusIn() bool
	// StatusIn returns the status in condition.
	StatusIn() []string
	// SetStatusIn sets the status in condition.
	SetStatusIn(statusIn []string) SiteQueryInterface
}

SiteQueryInterface defines the methods required for querying site data.

func SiteQuery

func SiteQuery() SiteQueryInterface

SiteQuery returns a new instance of SiteQueryInterface with an initialized parameters map.

type StoreInterface

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

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

	MenusEnabled() bool

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

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

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

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

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

	TranslationsEnabled() bool

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

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

	Shortcodes() []ShortcodeInterface
	AddShortcode(shortcode ShortcodeInterface)
	AddShortcodes(shortcodes []ShortcodeInterface)
	SetShortcodes(shortcodes []ShortcodeInterface)

	Middlewares() []MiddlewareInterface
	AddMiddleware(middleware MiddlewareInterface)
	AddMiddlewares(middlewares []MiddlewareInterface)
	SetMiddlewares(middlewares []MiddlewareInterface)
}

func NewStore

func NewStore(opts NewStoreOptions) (StoreInterface, error)

NewStore creates a new CMS store based on the provided options.

type TemplateInterface

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

func NewTemplate() TemplateInterface

func NewTemplateFromExistingData

func NewTemplateFromExistingData(data map[string]string) TemplateInterface

type TemplateQueryInterface

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

func TemplateQuery() TemplateQueryInterface

type TranslationInterface

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

func NewTranslation() TranslationInterface

func NewTranslationFromExistingData

func NewTranslationFromExistingData(data map[string]string) TranslationInterface

type TranslationQueryInterface

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

	HasHandleOrID() bool
	HandleOrID() string
	SetHandleOrID(handleOrID 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

func TranslationQuery() TranslationQueryInterface

type VersioningInterface

type VersioningInterface interface {
	versionstore.VersionInterface
}

func NewVersioning

func NewVersioning() VersioningInterface

type VersioningQueryInterface

type VersioningQueryInterface interface {
	versionstore.VersionQueryInterface
}

func NewVersioningQuery

func NewVersioningQuery() VersioningQueryInterface

Directories

Path Synopsis
development command

Jump to

Keyboard shortcuts

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