cmsstore

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: AGPL-3.0 Imports: 13 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/blockeditor

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_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_SITE_ID = "site_id"
View Source
const COLUMN_SOFT_DELETED_AT = "soft_deleted_at"
View Source
const COLUMN_STATUS = "status"
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 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 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"

Variables

This section is empty.

Functions

func NewBlockFromExistingData added in v0.2.0

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

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

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

	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 {
	ID() string
	SetID(id string) (BlockQueryInterface, error)

	IDIn() []string
	SetIDIn(idIn []string) (BlockQueryInterface, error)

	NameLike() string
	SetNameLike(nameLike string) (BlockQueryInterface, error)

	Status() string
	SetStatus(status string) (BlockQueryInterface, error)

	StatusIn() []string
	SetStatusIn(statusIn []string) (BlockQueryInterface, error)

	Handle() string
	SetHandle(handle string) (BlockQueryInterface, error)

	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) (BlockQueryInterface, error)

	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) (BlockQueryInterface, error)

	Offset() int
	SetOffset(offset int) (BlockQueryInterface, error)

	Limit() int
	SetLimit(limit int) (BlockQueryInterface, error)

	SortOrder() string
	SetSortOrder(sortOrder string) (BlockQueryInterface, error)

	OrderBy() string
	SetOrderBy(orderBy string) (BlockQueryInterface, error)

	CountOnly() bool
	SetCountOnly(countOnly bool) BlockQueryInterface

	WithSoftDeleted() bool
	SetWithSoftDeleted(withDeleted bool) BlockQueryInterface
}

func NewBlockQuery added in v0.2.1

func NewBlockQuery() BlockQueryInterface

type BlockQueryOptions added in v0.2.1

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

type NewStoreOptions added in v0.1.0

type NewStoreOptions struct {
	BlockTableName     string
	PageTableName      string
	SiteTableName      string
	TemplateTableName  string
	DB                 *sql.DB
	DbDriverName       string
	AutomigrateEnabled bool
	DebugEnabled       bool
}

NewStoreOptions define the options for creating a new block store

type PageInterface added in v0.1.0

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

	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 {
	ID() string
	SetID(id string) (PageQueryInterface, error)

	IDIn() []string
	SetIDIn(idIn []string) (PageQueryInterface, error)

	Handle() string
	SetHandle(handle string) (PageQueryInterface, error)

	AliasLike() string
	SetAliasLike(nameLike string) (PageQueryInterface, error)

	NameLike() string
	SetNameLike(nameLike string) (PageQueryInterface, error)

	Status() string
	SetStatus(status string) (PageQueryInterface, error)

	StatusIn() []string
	SetStatusIn(statusIn []string) (PageQueryInterface, error)

	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) (PageQueryInterface, error)

	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) (PageQueryInterface, error)

	Offset() int
	SetOffset(offset int) (PageQueryInterface, error)

	Limit() int
	SetLimit(limit int) (PageQueryInterface, error)

	SortOrder() string
	SetSortOrder(sortOrder string) (PageQueryInterface, error)

	OrderBy() string
	SetOrderBy(orderBy string) (PageQueryInterface, error)

	CountOnly() bool
	SetCountOnly(countOnly bool) PageQueryInterface

	WithSoftDeleted() bool
	SetWithSoftDeleted(withDeleted bool) PageQueryInterface
}

func NewPageQuery added in v0.1.0

func NewPageQuery() PageQueryInterface

type PageQueryOptions added in v0.1.0

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

type SiteInterface added in v0.2.1

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

	ID() string
	SetID(id string) SiteInterface

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

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

	Handle() string
	SetHandle(handle 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 {
	ID() string
	SetID(id string) (SiteQueryInterface, error)

	IDIn() []string
	SetIDIn(idIn []string) (SiteQueryInterface, error)

	NameLike() string
	SetNameLike(nameLike string) (SiteQueryInterface, error)

	Status() string
	SetStatus(status string) (SiteQueryInterface, error)

	StatusIn() []string
	SetStatusIn(statusIn []string) (SiteQueryInterface, error)

	Handle() string
	SetHandle(handle string) (SiteQueryInterface, error)

	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) (SiteQueryInterface, error)

	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) (SiteQueryInterface, error)

	Offset() int
	SetOffset(offset int) (SiteQueryInterface, error)

	Limit() int
	SetLimit(limit int) (SiteQueryInterface, error)

	SortOrder() string
	SetSortOrder(sortOrder string) (SiteQueryInterface, error)

	OrderBy() string
	SetOrderBy(orderBy string) (SiteQueryInterface, error)

	CountOnly() bool
	SetCountOnly(countOnly bool) SiteQueryInterface

	WithSoftDeleted() bool
	SetWithSoftDeleted(withDeleted bool) SiteQueryInterface
}

func NewSiteQuery added in v0.2.1

func NewSiteQuery() 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() 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

	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
	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
}

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 {
	ID() string
	SetID(id string) (TemplateQueryInterface, error)

	IDIn() []string
	SetIDIn(idIn []string) (TemplateQueryInterface, error)

	NameLike() string
	SetNameLike(nameLike string) (TemplateQueryInterface, error)

	Status() string
	SetStatus(status string) (TemplateQueryInterface, error)

	StatusIn() []string
	SetStatusIn(statusIn []string) (TemplateQueryInterface, error)

	Handle() string
	SetHandle(handle string) (TemplateQueryInterface, error)

	CreatedAtGte() string
	SetCreatedAtGte(createdAtGte string) (TemplateQueryInterface, error)

	CreatedAtLte() string
	SetCreatedAtLte(createdAtLte string) (TemplateQueryInterface, error)

	Offset() int
	SetOffset(offset int) (TemplateQueryInterface, error)

	Limit() int
	SetLimit(limit int) (TemplateQueryInterface, error)

	SortOrder() string
	SetSortOrder(sortOrder string) (TemplateQueryInterface, error)

	OrderBy() string
	SetOrderBy(orderBy string) (TemplateQueryInterface, error)

	CountOnly() bool
	SetCountOnly(countOnly bool) TemplateQueryInterface

	WithSoftDeleted() bool
	SetWithSoftDeleted(withDeleted bool) TemplateQueryInterface
}

func NewTemplateQuery added in v0.2.1

func NewTemplateQuery() TemplateQueryInterface

type TemplateQueryOptions added in v0.2.1

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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