valueobject

package
v0.2.50 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2026 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnoughTime

func EnoughTime(key string, cb func(key string) error) bool

func GetIdFromQueryString

func GetIdFromQueryString(queryString string) (string, error)

func Slug

func Slug(i content.Identifiable) (string, error)

Slug returns a URL friendly string from the title of a post item

func StringToSlug

func StringToSlug(s string) (string, error)

Types

type Author

type Author struct {
	Item

	FirstName string `json:"first_name"`
	LastName  string `json:"last_name"`
	Email     string `json:"email"`
	SiteURL   string `json:"site_url"`
	Avatar    string `json:"avatar"`
}

func (*Author) AfterAPICreate

func (s *Author) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Author) Approve

func (s *Author) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Author) AutoApprove

func (s *Author) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Author) BeforeAPICreate

func (s *Author) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Author) Create

func (s *Author) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Author) IndexContent

func (s *Author) IndexContent() bool

func (*Author) MarshalEditor

func (s *Author) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Author) String

func (s *Author) String() string

String defines the display name of a Song in the CMS list-view

type CTA added in v0.2.1

type CTA struct {
	Item

	Name  string `json:"name"`
	Email string `json:"email"`
}

func (*CTA) AfterAPICreate added in v0.2.1

func (s *CTA) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

func (*CTA) Approve added in v0.2.1

func (s *CTA) Approve(res http.ResponseWriter, req *http.Request) error

func (*CTA) AutoApprove added in v0.2.1

func (s *CTA) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*CTA) BeforeAPICreate added in v0.2.1

func (s *CTA) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

func (*CTA) Create added in v0.2.1

func (s *CTA) Create(res http.ResponseWriter, req *http.Request) error

func (*CTA) IndexContent added in v0.2.1

func (s *CTA) IndexContent() bool

func (*CTA) MarshalEditor added in v0.2.1

func (s *CTA) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*CTA) SetHash added in v0.2.1

func (s *CTA) SetHash()

func (*CTA) String added in v0.2.1

func (s *CTA) String() string

String defines the display name of a Song in the CMS list-view

type Counter added in v0.2.2

type Counter struct {
	Item

	Kind      string `json:"kind"`
	RequestID string `json:"request_id"`
}

func (*Counter) AfterAPICreate added in v0.2.2

func (s *Counter) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

func (*Counter) Approve added in v0.2.2

func (s *Counter) Approve(res http.ResponseWriter, req *http.Request) error

func (*Counter) AutoApprove added in v0.2.2

func (s *Counter) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*Counter) BeforeAPICreate added in v0.2.2

func (s *Counter) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

func (*Counter) Create added in v0.2.2

func (s *Counter) Create(res http.ResponseWriter, req *http.Request) error

func (*Counter) IndexContent added in v0.2.2

func (s *Counter) IndexContent() bool

func (*Counter) MarshalEditor added in v0.2.2

func (s *Counter) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Counter) SetHash added in v0.2.2

func (s *Counter) SetHash()

func (*Counter) String added in v0.2.2

func (s *Counter) String() string

String defines the display name of a Song in the CMS list-view

type Deployment

type Deployment struct {
	Item

	Domain string `json:"domain"`

	SiteID   string `json:"site_id"`
	SiteName string `json:"site_name"`
	SitePath string `json:"site_path"`
	HostName string `json:"host_name"`

	Status string `json:"status"`
	// contains filtered or unexported fields
}

func (*Deployment) AfterAPICreate

func (s *Deployment) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Deployment) Approve

func (s *Deployment) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Deployment) AutoApprove

func (s *Deployment) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Deployment) BeforeAPICreate

func (s *Deployment) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Deployment) Create

func (s *Deployment) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Deployment) IndexContent

func (s *Deployment) IndexContent() bool

func (*Deployment) IsNewDeployment

func (s *Deployment) IsNewDeployment() bool

func (*Deployment) MarshalEditor

func (s *Deployment) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Deployment) SelectContentTypes

func (s *Deployment) SelectContentTypes() []string

func (*Deployment) SetHash

func (s *Deployment) SetHash()

func (*Deployment) SetSelectData

func (s *Deployment) SetSelectData(data map[string][][]byte)

func (*Deployment) String

func (s *Deployment) String() string

String defines the display name of a Song in the CMS list-view

type Domain

type Domain struct {
	Item

	Root  string `json:"root"`
	Sub   string `json:"sub"`
	Owner string `json:"owner"`
}

func (*Domain) AfterAPICreate

func (d *Domain) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Domain) Approve

func (d *Domain) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Domain) AutoApprove

func (d *Domain) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Domain) BeforeAPICreate

func (d *Domain) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Domain) Create

func (d *Domain) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Domain) FullDomain

func (d *Domain) FullDomain() string

func (*Domain) IndexContent

func (d *Domain) IndexContent() bool

func (*Domain) MarshalEditor

func (d *Domain) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Domain) Name

func (d *Domain) Name() string

func (*Domain) SetHash

func (d *Domain) SetHash()

func (*Domain) String

func (d *Domain) String() string

String defines the display name of a Song in the CMS list-view

type File

type File struct {
	Fs      afero.Fs
	Path    string
	Content []byte
}

func (*File) Dump

func (f *File) Dump() error

type Image added in v0.1.27

type Image struct {
	Item

	Name string   `json:"name"`
	Desc string   `json:"desc"`
	Tags []string `json:"tags"`

	Asset  string `json:"asset"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

func (*Image) AfterAPICreate added in v0.1.27

func (s *Image) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Image) Approve added in v0.1.27

func (s *Image) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Image) AutoApprove added in v0.1.27

func (s *Image) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Image) BeforeAPICreate added in v0.1.27

func (s *Image) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Image) Create added in v0.1.27

func (s *Image) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Image) GetHeight added in v0.1.48

func (s *Image) GetHeight() int

func (*Image) GetWidth added in v0.1.48

func (s *Image) GetWidth() int

func (*Image) IndexContent added in v0.1.27

func (s *Image) IndexContent() bool

func (*Image) ItemTags added in v0.1.48

func (s *Image) ItemTags() []string

func (*Image) MarshalEditor added in v0.1.27

func (s *Image) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Image) SetMeta added in v0.1.48

func (s *Image) SetMeta(service content.DirService) error

func (*Image) String added in v0.1.27

func (s *Image) String() string

String defines the display name of a Song in the CMS list-view

type Index

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

func CreateIndex

func CreateIndex(target string) *Index

func NewIndex

func NewIndex(ns, id string) *Index

func (*Index) ContentType

func (i *Index) ContentType() string

func (*Index) ID

func (i *Index) ID() string

func (*Index) Namespace

func (i *Index) Namespace() string

func (*Index) String

func (i *Index) String() string

type Instance added in v0.2.47

type Instance struct {
	Item

	// 唯一标识
	InstanceID string `json:"instance_id"` // SHA256(machine_id + salt)
	Domain     string `json:"domain"`      // 实例域名

	// 总体统计
	TotalLicenses int `json:"total_licenses"`
	TotalTrials   int `json:"total_trials"`

	// 基本信息(用于管理)
	Version   string `json:"version"`
	IPAddress string `json:"ip_address"`
	UserAgent string `json:"user_agent"`

	// 状态控制(核心)
	Status InstanceStatus `json:"status"` // active / blocked / suspended

	// 心跳信息
	LastSeenAt int64 `json:"last_seen_at"`
	CreatedAt  int64 `json:"created_at"`

	// 控制策略(可选扩展)
	AllowOfflineSeconds int64 `json:"allow_offline_seconds"` // 允许离线多久
}

func (*Instance) Approve added in v0.2.47

func (l *Instance) Approve(res http.ResponseWriter, req *http.Request) error

func (*Instance) AutoApprove added in v0.2.47

func (l *Instance) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*Instance) Create added in v0.2.47

func (l *Instance) Create(res http.ResponseWriter, req *http.Request) error

func (*Instance) IndexContent added in v0.2.47

func (l *Instance) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*Instance) ItemHash added in v0.2.47

func (l *Instance) ItemHash() string

func (*Instance) ItemSlug added in v0.2.47

func (l *Instance) ItemSlug() string

func (*Instance) MarshalEditor added in v0.2.47

func (l *Instance) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*Instance) SetHash added in v0.2.47

func (l *Instance) SetHash()

SetHash 使用 LicenseKey 的 MD5 作为 hash,用于快速查找 存入 __contentIndex["license:{hash}"] → ID

func (*Instance) SetSlug added in v0.2.47

func (l *Instance) SetSlug(slug string)

SetSlug 使用 LicenseKey 作为 slug,存入 ns__index bucket

func (*Instance) String added in v0.2.47

func (l *Instance) String() string

String 定义在 CMS 列表中的显示名称

type InstanceStatus added in v0.2.47

type InstanceStatus string
const (
	InstanceActive    InstanceStatus = "active"
	InstanceBlocked   InstanceStatus = "blocked"   // ❌ 直接禁用
	InstanceSuspended InstanceStatus = "suspended" // ⚠️ 降级
)

type Item

type Item struct {
	UUID      uuid.UUID      `json:"uuid"`
	Status    content.Status `json:"status"`
	Namespace string         `json:"namespace"`
	ID        int            `json:"id"`
	Slug      string         `json:"slug"`
	Hash      string         `json:"hash"`
	Timestamp int64          `json:"timestamp"`
	Updated   int64          `json:"updated"`
}

Item should only be embedded into content type structs.

func NewItem

func NewItem() (*Item, error)

func NewItemWithNamespace

func NewItemWithNamespace(namespace string) (*Item, error)

func (*Item) AfterAPICreate

func (i *Item) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterAPIDelete

func (i *Item) AfterAPIDelete(res http.ResponseWriter, req *http.Request) error

AfterAPIDelete is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterAPIResponse

func (i *Item) AfterAPIResponse(res http.ResponseWriter, req *http.Request, data []byte) error

AfterAPIResponse is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterAPIUpdate

func (i *Item) AfterAPIUpdate(res http.ResponseWriter, req *http.Request) error

AfterAPIUpdate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterAdminCreate

func (i *Item) AfterAdminCreate(res http.ResponseWriter, req *http.Request) error

AfterAdminCreate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterAdminDelete

func (i *Item) AfterAdminDelete(res http.ResponseWriter, req *http.Request) error

AfterAdminDelete is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterAdminUpdate

func (i *Item) AfterAdminUpdate(res http.ResponseWriter, req *http.Request) error

AfterAdminUpdate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterApprove

func (i *Item) AfterApprove(res http.ResponseWriter, req *http.Request) error

AfterApprove is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterDelete

func (i *Item) AfterDelete(res http.ResponseWriter, req *http.Request) error

AfterDelete is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterDisable

func (i *Item) AfterDisable(res http.ResponseWriter, req *http.Request) error

AfterDisable is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterEnable

func (i *Item) AfterEnable(res http.ResponseWriter, req *http.Request) error

AfterEnable is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterReject

func (i *Item) AfterReject(res http.ResponseWriter, req *http.Request) error

AfterReject is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) AfterSave

func (i *Item) AfterSave(res http.ResponseWriter, req *http.Request) error

AfterSave is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAPICreate

func (i *Item) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAPIDelete

func (i *Item) BeforeAPIDelete(res http.ResponseWriter, req *http.Request) error

BeforeAPIDelete is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAPIResponse

func (i *Item) BeforeAPIResponse(res http.ResponseWriter, req *http.Request, data []byte) ([]byte, error)

BeforeAPIResponse is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAPIUpdate

func (i *Item) BeforeAPIUpdate(res http.ResponseWriter, req *http.Request) error

BeforeAPIUpdate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAdminCreate

func (i *Item) BeforeAdminCreate(res http.ResponseWriter, req *http.Request) error

BeforeAdminCreate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAdminDelete

func (i *Item) BeforeAdminDelete(res http.ResponseWriter, req *http.Request) error

BeforeAdminDelete is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeAdminUpdate

func (i *Item) BeforeAdminUpdate(res http.ResponseWriter, req *http.Request) error

BeforeAdminUpdate is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeApprove

func (i *Item) BeforeApprove(res http.ResponseWriter, req *http.Request) error

BeforeApprove is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeDelete

func (i *Item) BeforeDelete(res http.ResponseWriter, req *http.Request) error

BeforeDelete is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeDisable

func (i *Item) BeforeDisable(res http.ResponseWriter, req *http.Request) error

BeforeDisable is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeEnable

func (i *Item) BeforeEnable(res http.ResponseWriter, req *http.Request) error

BeforeEnable is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeReject

func (i *Item) BeforeReject(res http.ResponseWriter, req *http.Request) error

BeforeReject is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) BeforeSave

func (i *Item) BeforeSave(res http.ResponseWriter, req *http.Request) error

BeforeSave is a no-op to ensure structs which embed *Item implement Hookable

func (*Item) IndexContent

func (i *Item) IndexContent() bool

IndexContent determines if a type should be indexed for searching partially implements search.Searchable

func (*Item) ItemHash

func (i *Item) ItemHash() string

ItemHash gets the item's hash

func (*Item) ItemID

func (i *Item) ItemID() int

ItemID gets the *Item's ID field partially implements the Identifiable interface

func (*Item) ItemName

func (i *Item) ItemName() string

ItemName gets the *Item's Namespace field partially implements the Identifiable interface

func (*Item) ItemSlug

func (i *Item) ItemSlug() string

ItemSlug sets the item's slug for its URL

func (*Item) ItemStatus

func (i *Item) ItemStatus() content.Status

ItemStatus gets the *Item's Status field partially implements the Identifiable interface

func (*Item) QueryString

func (i *Item) QueryString() string

func (*Item) SearchMapping

func (i *Item) SearchMapping() (*mapping.IndexMappingImpl, error)

SearchMapping returns a default implementation of a Bleve IndexMappingImpl partially implements search.Searchable

func (*Item) SetItemID

func (i *Item) SetItemID(id int)

SetItemID sets the *Item's ID field partially implements the Identifiable interface

func (*Item) SetItemStatus

func (i *Item) SetItemStatus(status content.Status)

SetItemStatus sets the *Item's Status field partially implements the Identifiable interface

func (*Item) SetSlug

func (i *Item) SetSlug(slug string)

SetSlug sets the item's slug for its URL

func (*Item) SetUniqueID

func (i *Item) SetUniqueID(uuid uuid.UUID)

func (*Item) String

func (i *Item) String() string

String formats an *Item into a printable value partially implements the Identifiable interface

func (*Item) Time

func (i *Item) Time() int64

Time partially implements the Sortable interface

func (*Item) Touch

func (i *Item) Touch() int64

Touch partially implements the Sortable interface

func (*Item) UniqueID

func (i *Item) UniqueID() uuid.UUID

UniqueID gets the *Item's UUID field partially implements the Identifiable interface

func (*Item) UpdateTime

func (i *Item) UpdateTime() time.Time

type Language

type Language struct {
	Item

	Name string `json:"name"`
	Code string `json:"code"`
}

func (*Language) Approve

func (a *Language) Approve(http.ResponseWriter, *http.Request) error

func (*Language) Create

func (a *Language) Create(res http.ResponseWriter, req *http.Request) error

func (*Language) IndexContent

func (a *Language) IndexContent() bool

func (*Language) MarshalEditor

func (a *Language) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Artist within the CMS and implements editor.Editable

func (*Language) SetHash

func (a *Language) SetHash()

func (*Language) String

func (a *Language) String() string

String defines how a Artist is printed. Update it using more descriptive fields from the Artist struct type

type License added in v0.2.3

type License struct {
	Item

	LicenseKey string      `json:"license_key"` // MDF-XXXX-XXXX-XXXX
	Plan       LicensePlan `json:"plan"`

	// 有效期
	IssueDate  int64 `json:"issue_date"`
	ExpiryDate int64 `json:"expiry_date"`

	// 激活状态
	Activated   bool  `json:"activated"`
	ActivatedAt int64 `json:"activated_at"`

	// 设备/IP 限制 (治理用)
	MaxDevices     int `json:"max_devices"`     // 最大设备数,默认 3
	MaxIPs         int `json:"max_ips"`         // 最大 IP 数,默认 3
	CurrentDevices int `json:"current_devices"` // 当前设备数
	CurrentIPs     int `json:"current_ips"`     // 当前 IP 数

	// Sync 功能
	SyncEnabled bool `json:"sync_enabled"`
	SyncQuotaMB int  `json:"sync_quota"`

	// Publish 功能
	PublishEnabled  bool `json:"publish_enabled"`
	MaxSites        int  `json:"max_sites"`
	MaxStorageMB    int  `json:"max_storage"`
	CustomDomain    bool `json:"custom_domain"`
	CustomSubDomain bool `json:"custom_sub_domain"` // 二级域名
}

License 作为 Content ValueObject,管理用户许可证

func (*License) Approve added in v0.2.3

func (l *License) Approve(res http.ResponseWriter, req *http.Request) error

func (*License) AutoApprove added in v0.2.3

func (l *License) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*License) CanAddDevice added in v0.2.3

func (l *License) CanAddDevice() bool

CanAddDevice 检查是否可以添加新设备

func (*License) CanAddIP added in v0.2.3

func (l *License) CanAddIP() bool

CanAddIP 检查是否可以添加新 IP

func (*License) Create added in v0.2.3

func (l *License) Create(res http.ResponseWriter, req *http.Request) error

func (*License) GetFeatures added in v0.2.3

func (l *License) GetFeatures() *LicenseFeatures

GetFeatures 获取当前套餐的功能特性

func (*License) IndexContent added in v0.2.3

func (l *License) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*License) IsExpired added in v0.2.3

func (l *License) IsExpired() bool

IsExpired 检查许可证是否过期

func (*License) IsValid added in v0.2.3

func (l *License) IsValid() bool

IsValid 检查许可证是否有效 (已激活且未过期)

func (*License) ItemHash added in v0.2.3

func (l *License) ItemHash() string

func (*License) ItemSlug added in v0.2.3

func (l *License) ItemSlug() string

func (*License) MarshalEditor added in v0.2.3

func (l *License) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*License) SetHash added in v0.2.3

func (l *License) SetHash()

SetHash 使用 LicenseKey 的 MD5 作为 hash,用于快速查找 存入 __contentIndex["license:{hash}"] → ID

func (*License) SetSlug added in v0.2.3

func (l *License) SetSlug(slug string)

SetSlug 使用 LicenseKey 作为 slug,存入 ns__index bucket

func (*License) String added in v0.2.3

func (l *License) String() string

String 定义在 CMS 列表中的显示名称

func (*License) ToEmail added in v0.2.3

func (l *License) ToEmail() string

ToEmail 将 LicenseKey 转换为用户邮箱 例如: MDF-ABCD-EFGH-JKLM → abcd-efgh-jklm@mdfriday.com

func (*License) ToPassword added in v0.2.3

func (l *License) ToPassword() string

ToPassword 将 LicenseKey 转换为密码 (base64 编码)

func (*License) ToUserDir added in v0.2.3

func (l *License) ToUserDir() string

ToUserDir 生成用户目录名 (hash 前 16 位)

func (*License) ToUserShortDir added in v0.2.42

func (l *License) ToUserShortDir() string

type LicenseDevice added in v0.2.3

type LicenseDevice struct {
	Item

	License    string `json:"license"`     // 关联的 License Key
	DeviceID   string `json:"device_id"`   // 设备唯一标识
	DeviceName string `json:"device_name"` // 设备名称 (UA/OS 等)
	DeviceType string `json:"device_type"` // desktop / mobile / tablet

	// 使用信息
	FirstSeenAt int64 `json:"first_seen_at"` // 首次使用时间
	LastSeenAt  int64 `json:"last_seen_at"`  // 最后使用时间
	AccessCount int   `json:"access_count"`  // 访问次数

	// 状态
	Status string `json:"status"` // active / blocked
}

LicenseDevice 设备记录表 (治理用) BoltDB 存储: licensedevice / licensedevice__index Hash: MD5(License:DeviceID) | Slug: {License}:{DeviceID[:8]}

func (*LicenseDevice) Approve added in v0.2.3

func (d *LicenseDevice) Approve(res http.ResponseWriter, req *http.Request) error

func (*LicenseDevice) AutoApprove added in v0.2.3

func (d *LicenseDevice) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*LicenseDevice) Create added in v0.2.3

func (d *LicenseDevice) Create(res http.ResponseWriter, req *http.Request) error

func (*LicenseDevice) IndexContent added in v0.2.3

func (d *LicenseDevice) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*LicenseDevice) ItemHash added in v0.2.3

func (d *LicenseDevice) ItemHash() string

func (*LicenseDevice) ItemSlug added in v0.2.3

func (d *LicenseDevice) ItemSlug() string

func (*LicenseDevice) MarshalEditor added in v0.2.3

func (d *LicenseDevice) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*LicenseDevice) SetHash added in v0.2.3

func (d *LicenseDevice) SetHash()

SetHash 使用 License + DeviceID 的组合 hash 存入 __contentIndex["licensedevice:{hash}"] → ID

func (*LicenseDevice) SetSlug added in v0.2.3

func (d *LicenseDevice) SetSlug(slug string)

SetSlug 使用 "License:DeviceID[:8]" 格式,支持按 License 前缀查询

func (*LicenseDevice) String added in v0.2.3

func (d *LicenseDevice) String() string

String 定义在 CMS 列表中的显示名称

type LicenseFeatures added in v0.2.3

type LicenseFeatures struct {
	// 设备/IP 限制
	MaxDevices int `json:"max_devices"`
	MaxIPs     int `json:"max_ips"`

	// Sync 功能
	SyncEnabled bool `json:"sync_enabled"`
	SyncQuotaMB int  `json:"sync_quota"`

	// Publish 功能
	PublishEnabled  bool `json:"publish_enabled"`
	MaxSites        int  `json:"max_sites"`
	MaxStorageMB    int  `json:"max_storage"`
	CustomDomain    bool `json:"custom_domain"`
	CustomSubDomain bool `json:"custom_sub_domain"` // 二级域名

	// 有效期(天数)
	ValidityDays int `json:"validity_days"`
}

LicenseFeatures 定义各套餐的功能特性

func GetPlanFeatures added in v0.2.3

func GetPlanFeatures(plan LicensePlan) *LicenseFeatures

GetPlanFeatures 根据套餐类型获取功能特性

type LicenseIP added in v0.2.3

type LicenseIP struct {
	Item

	License   string `json:"license"`    // 关联的 License Key
	IPAddress string `json:"ip_address"` // IP 地址

	// 地理位置信息 (可选)
	Country string `json:"country"`
	Region  string `json:"region"`
	City    string `json:"city"`

	// 使用信息
	FirstSeenAt int64 `json:"first_seen_at"` // 首次使用时间
	LastSeenAt  int64 `json:"last_seen_at"`  // 最后使用时间
	AccessCount int   `json:"access_count"`  // 访问次数

	// 状态
	Status string `json:"status"` // active / blocked
}

LicenseIP IP 记录表 (治理用) BoltDB 存储: licenseip / licenseip__index Hash: MD5(License:IPAddress) | Slug: {License}:{IPAddress}

func (*LicenseIP) Approve added in v0.2.3

func (i *LicenseIP) Approve(res http.ResponseWriter, req *http.Request) error

func (*LicenseIP) AutoApprove added in v0.2.3

func (i *LicenseIP) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*LicenseIP) Create added in v0.2.3

func (i *LicenseIP) Create(res http.ResponseWriter, req *http.Request) error

func (*LicenseIP) IndexContent added in v0.2.3

func (i *LicenseIP) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*LicenseIP) ItemHash added in v0.2.3

func (i *LicenseIP) ItemHash() string

func (*LicenseIP) ItemSlug added in v0.2.3

func (i *LicenseIP) ItemSlug() string

func (*LicenseIP) MarshalEditor added in v0.2.3

func (i *LicenseIP) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*LicenseIP) SetHash added in v0.2.3

func (i *LicenseIP) SetHash()

SetHash 使用 License + IPAddress 的组合 hash 存入 __contentIndex["licenseip:{hash}"] → ID

func (*LicenseIP) SetSlug added in v0.2.3

func (i *LicenseIP) SetSlug(slug string)

SetSlug 使用 "License:IPAddress" 格式,支持按 License 前缀查询

func (*LicenseIP) String added in v0.2.3

func (i *LicenseIP) String() string

String 定义在 CMS 列表中的显示名称

type LicensePlan added in v0.2.3

type LicensePlan string

LicensePlan 定义许可证套餐类型

const (
	PlanFree       LicensePlan = "free"
	PlanStarter    LicensePlan = "starter"
	PlanEnjoy      LicensePlan = "enjoy"
	PlanCreator    LicensePlan = "creator"
	PlanPro        LicensePlan = "pro"
	PlanEnterprise LicensePlan = "enterprise"
)

type LicenseTrial added in v0.2.30

type LicenseTrial struct {
	Item

	Email   string `json:"email"`   // 申请邮箱(唯一标识)
	License string `json:"license"` // 生成的 License Key
}

LicenseTrial 记录试用 License 申请信息 一个邮箱只能申请一次试用码

func (*LicenseTrial) AfterAPICreate added in v0.2.30

func (t *LicenseTrial) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

func (*LicenseTrial) Approve added in v0.2.30

func (t *LicenseTrial) Approve(res http.ResponseWriter, req *http.Request) error

func (*LicenseTrial) AutoApprove added in v0.2.30

func (t *LicenseTrial) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*LicenseTrial) BeforeAPICreate added in v0.2.30

func (t *LicenseTrial) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

func (*LicenseTrial) Create added in v0.2.30

func (t *LicenseTrial) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the LicenseTrial struct fields, and is multipart encoded

func (*LicenseTrial) IndexContent added in v0.2.30

func (t *LicenseTrial) IndexContent() bool

func (*LicenseTrial) ItemHash added in v0.2.30

func (t *LicenseTrial) ItemHash() string

func (*LicenseTrial) ItemSlug added in v0.2.30

func (t *LicenseTrial) ItemSlug() string

func (*LicenseTrial) MarshalEditor added in v0.2.30

func (t *LicenseTrial) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a LicenseTrial within the CMS and implements editor.Editable

func (*LicenseTrial) Name added in v0.2.30

func (t *LicenseTrial) Name() string

func (*LicenseTrial) SetHash added in v0.2.30

func (t *LicenseTrial) SetHash()

SetHash 使用 email 作为 hash key

func (*LicenseTrial) SetSlug added in v0.2.30

func (t *LicenseTrial) SetSlug(slug string)

SetSlug 使用 email 作为 slug

func (*LicenseTrial) String added in v0.2.30

func (t *LicenseTrial) String() string

String defines the display name of a LicenseTrial in the CMS list-view

type LicenseUsage added in v0.2.5

type LicenseUsage struct {
	Item

	LicenseKey string `json:"license_key"` // 关联的 License Key

	// 当前使用量
	CurrentIPs     int `json:"current_ips"`     // 当前 IP 使用量
	CurrentDevices int `json:"current_devices"` // 当前设备使用量

	// 磁盘使用量 (单位: mb)
	SyncDiskUsage    int64 `json:"sync_disk_usage"`    // Sync 磁盘使用量
	PublishDiskUsage int64 `json:"publish_disk_usage"` // Publish 磁盘使用量

	// 更新时间
	LastUpdatedAt int64 `json:"last_updated_at"` // 最后更新时间
}

LicenseUsage 许可证使用统计 (治理用) BoltDB 存储: licenseusage / licenseusage__index Hash: MD5(LicenseKey) | Slug: {LicenseKey}

func (*LicenseUsage) Approve added in v0.2.5

func (u *LicenseUsage) Approve(res http.ResponseWriter, req *http.Request) error

func (*LicenseUsage) AutoApprove added in v0.2.5

func (u *LicenseUsage) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*LicenseUsage) Create added in v0.2.5

func (u *LicenseUsage) Create(res http.ResponseWriter, req *http.Request) error

func (*LicenseUsage) GetPublishDiskUsageMB added in v0.2.5

func (u *LicenseUsage) GetPublishDiskUsageMB() float64

GetPublishDiskUsageMB 获取 Publish 磁盘使用量 (MB)

func (*LicenseUsage) GetSyncDiskUsageMB added in v0.2.5

func (u *LicenseUsage) GetSyncDiskUsageMB() float64

GetSyncDiskUsageMB 获取 Sync 磁盘使用量 (MB)

func (*LicenseUsage) GetTotalDiskUsage added in v0.2.5

func (u *LicenseUsage) GetTotalDiskUsage() int64

GetTotalDiskUsage 获取总磁盘使用量 (bytes)

func (*LicenseUsage) GetTotalDiskUsageMB added in v0.2.5

func (u *LicenseUsage) GetTotalDiskUsageMB() float64

GetTotalDiskUsageMB 获取总磁盘使用量 (MB)

func (*LicenseUsage) IndexContent added in v0.2.5

func (u *LicenseUsage) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*LicenseUsage) ItemHash added in v0.2.5

func (u *LicenseUsage) ItemHash() string

func (*LicenseUsage) ItemSlug added in v0.2.5

func (u *LicenseUsage) ItemSlug() string

func (*LicenseUsage) MarshalEditor added in v0.2.5

func (u *LicenseUsage) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*LicenseUsage) SetHash added in v0.2.5

func (u *LicenseUsage) SetHash()

SetHash 使用 LicenseKey 的 MD5 作为 hash,用于快速查找 存入 __contentIndex["licenseusage:{hash}"] → ID

func (*LicenseUsage) SetSlug added in v0.2.5

func (u *LicenseUsage) SetSlug(slug string)

SetSlug 使用 LicenseKey 作为 slug,存入 ns__index bucket

func (*LicenseUsage) String added in v0.2.5

func (u *LicenseUsage) String() string

String 定义在 CMS 列表中的显示名称

type MDFPreview added in v0.2.1

type MDFPreview struct {
	Item

	Name  string `json:"name"`
	Type  string `json:"type"`
	Path  string `json:"path"`
	Asset string `json:"asset"`
	Size  string `json:"size"`
}

func (*MDFPreview) AbsAssetPath added in v0.2.1

func (s *MDFPreview) AbsAssetPath(uploadDir string) (string, error)

func (*MDFPreview) AfterAPICreate added in v0.2.1

func (s *MDFPreview) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*MDFPreview) Approve added in v0.2.1

func (s *MDFPreview) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*MDFPreview) AutoApprove added in v0.2.1

func (s *MDFPreview) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*MDFPreview) BeforeAPICreate added in v0.2.1

func (s *MDFPreview) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*MDFPreview) Create added in v0.2.1

func (s *MDFPreview) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*MDFPreview) Deploy added in v0.2.1

func (s *MDFPreview) Deploy() bool

func (*MDFPreview) IndexContent added in v0.2.1

func (s *MDFPreview) IndexContent() bool

func (*MDFPreview) MarshalEditor added in v0.2.1

func (s *MDFPreview) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*MDFPreview) SetHash added in v0.2.1

func (s *MDFPreview) SetHash()

func (*MDFPreview) String added in v0.2.1

func (s *MDFPreview) String() string

String defines the display name of a Song in the CMS list-view

type Post

type Post struct {
	Item

	Title   string   `json:"title"`
	Content string   `json:"content"`
	Author  string   `json:"author"`
	Params  string   `json:"params"`
	Assets  []string `json:"assets"`
}

func (*Post) AfterAPICreate

func (s *Post) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Post) Approve

func (s *Post) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Post) AutoApprove

func (s *Post) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Post) BeforeAPICreate

func (s *Post) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Post) Create

func (s *Post) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Post) FrontMatter

func (s *Post) FrontMatter() string

func (*Post) FullContent

func (s *Post) FullContent() string

func (*Post) IndexContent

func (s *Post) IndexContent() bool

func (*Post) Markdown

func (s *Post) Markdown() ([]byte, error)

func (*Post) MarshalEditor

func (s *Post) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Post) Push

func (s *Post) Push(http.ResponseWriter, *http.Request) ([]string, error)

func (*Post) SetHash

func (s *Post) SetHash()

func (*Post) String

func (s *Post) String() string

String defines the display name of a Song in the CMS list-view

type Preview

type Preview struct {
	Item

	Domain string `json:"domain"`

	SiteID   string `json:"site_id"`
	SiteName string `json:"site_name"`
	SitePath string `json:"site_path"`
	HostName string `json:"host_name"`

	Status string `json:"status"`
	// contains filtered or unexported fields
}

func (*Preview) AfterAPICreate

func (s *Preview) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Preview) Approve

func (s *Preview) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Preview) AutoApprove

func (s *Preview) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Preview) BeforeAPICreate

func (s *Preview) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Preview) Create

func (s *Preview) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Preview) IndexContent

func (s *Preview) IndexContent() bool

func (*Preview) MarshalEditor

func (s *Preview) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Preview) SelectContentTypes

func (s *Preview) SelectContentTypes() []string

func (*Preview) SetHash

func (s *Preview) SetHash()

func (*Preview) SetSelectData

func (s *Preview) SetSelectData(data map[string][][]byte)

func (*Preview) String

func (s *Preview) String() string

String defines the display name of a Song in the CMS list-view

type PublishDomain added in v0.2.3

type PublishDomain struct {
	Item

	License   string `json:"license"`    // 关联的 License Key
	Folder    string `json:"folder"`     // 关联的用户文件夹
	SubDomain string `json:"sub_domain"` // 关联的子域名
	CusDomain string `json:"cus_domain"` // 关联的自定义域名
}

func (*PublishDomain) AfterAPICreate added in v0.2.18

func (d *PublishDomain) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

func (*PublishDomain) Approve added in v0.2.3

func (d *PublishDomain) Approve(res http.ResponseWriter, req *http.Request) error

func (*PublishDomain) AutoApprove added in v0.2.3

func (d *PublishDomain) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*PublishDomain) BeforeAPICreate added in v0.2.18

func (d *PublishDomain) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

func (*PublishDomain) Create added in v0.2.18

func (d *PublishDomain) Create(res http.ResponseWriter, req *http.Request) error

func (*PublishDomain) IndexContent added in v0.2.3

func (d *PublishDomain) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*PublishDomain) ItemHash added in v0.2.3

func (d *PublishDomain) ItemHash() string

func (*PublishDomain) ItemSlug added in v0.2.3

func (d *PublishDomain) ItemSlug() string

func (*PublishDomain) MarshalEditor added in v0.2.3

func (d *PublishDomain) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*PublishDomain) SetHash added in v0.2.3

func (d *PublishDomain) SetHash()

func (*PublishDomain) SetSlug added in v0.2.3

func (d *PublishDomain) SetSlug(slug string)

func (*PublishDomain) String added in v0.2.3

func (d *PublishDomain) String() string

type PublishSite added in v0.2.3

type PublishSite struct {
	Item

	License    string `json:"license"`     // 关联的 License Key
	Name       string `json:"name"`        // 站点名称
	SiteType   string `json:"site_type"`   // site / article
	Asset      string `json:"asset"`       // 资源文件路径 (zip)
	Size       int64  `json:"size"`        // 大小 (bytes)
	FolderPath string `json:"folder_path"` // 发布目录路径
	PublicURL  string `json:"public_url"`  // 公开访问 URL
	Status     string `json:"status"`      // pending / active / deleted
	CreatedAt  int64  `json:"created_at"`  // 创建时间
}

PublishSite 发布站点记录 BoltDB 存储: publishsite / publishsite__index Hash: MD5(License:Name) | Slug: {License}:{Name}

func (*PublishSite) AbsAssetPath added in v0.2.3

func (p *PublishSite) AbsAssetPath(uploadDir string) (string, error)

AbsAssetPath 获取资源文件的绝对路径

func (*PublishSite) Deploy added in v0.2.3

func (p *PublishSite) Deploy() bool

Deploy 标记此类型支持部署

func (*PublishSite) IndexContent added in v0.2.3

func (p *PublishSite) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*PublishSite) IsActive added in v0.2.3

func (p *PublishSite) IsActive() bool

IsActive 检查站点是否处于活跃状态

func (*PublishSite) MarshalEditor added in v0.2.3

func (p *PublishSite) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*PublishSite) SetHash added in v0.2.3

func (p *PublishSite) SetHash()

SetHash 使用 License + Name 的组合 hash 存入 __contentIndex["publishsite:{hash}"] → ID

func (*PublishSite) SetSlug added in v0.2.3

func (p *PublishSite) SetSlug(slug string)

SetSlug 使用 "License:Name" 格式,支持按 License 前缀查询

func (*PublishSite) String added in v0.2.3

func (p *PublishSite) String() string

String 定义在 CMS 列表中的显示名称

type PublishUsage added in v0.2.3

type PublishUsage struct {
	Item

	License      string `json:"license"`       // 关联的 License Key
	SiteCount    int    `json:"site_count"`    // 站点数量
	StorageBytes int64  `json:"storage_bytes"` // 存储字节数
	MaxSites     int    `json:"max_sites"`     // 最大站点数
	QuotaBytes   int64  `json:"quota_bytes"`   // 配额字节数
	RecordedAt   int64  `json:"recorded_at"`   // 记录时间
}

PublishUsage Publish 容量记录 BoltDB 存储: publishusage / publishusage__index Hash: MD5(License:RecordedAt) | 用于记录历史容量

func (*PublishUsage) CanAddSite added in v0.2.3

func (u *PublishUsage) CanAddSite() bool

CanAddSite 检查是否可以添加新站点

func (*PublishUsage) IndexContent added in v0.2.3

func (u *PublishUsage) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*PublishUsage) IsStorageOverQuota added in v0.2.3

func (u *PublishUsage) IsStorageOverQuota() bool

IsStorageOverQuota 检查存储是否超出配额

func (*PublishUsage) MarshalEditor added in v0.2.3

func (u *PublishUsage) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*PublishUsage) SetHash added in v0.2.3

func (u *PublishUsage) SetHash()

SetHash 使用 License + RecordedAt 的组合 hash 存入 __contentIndex["publishusage:{hash}"] → ID

func (*PublishUsage) SetSlug added in v0.2.3

func (u *PublishUsage) SetSlug(slug string)

SetSlug 使用 "License:RecordedAt" 格式

func (*PublishUsage) StoragePercentage added in v0.2.3

func (u *PublishUsage) StoragePercentage() float64

StoragePercentage 计算存储使用百分比

func (*PublishUsage) String added in v0.2.3

func (u *PublishUsage) String() string

String 定义在 CMS 列表中的显示名称

type Resource

type Resource struct {
	Item

	Name  string `json:"name"`
	Asset string `json:"asset"`
	Size  string `json:"size"`
}

func (*Resource) AfterAPICreate

func (s *Resource) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Resource) Approve

func (s *Resource) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Resource) AutoApprove

func (s *Resource) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Resource) BeforeAPICreate

func (s *Resource) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Resource) Create

func (s *Resource) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Resource) IndexContent

func (s *Resource) IndexContent() bool

func (*Resource) MarshalEditor

func (s *Resource) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Resource) SetHash

func (s *Resource) SetHash()

func (*Resource) String

func (s *Resource) String() string

String defines the display name of a Song in the CMS list-view

type ShortCode added in v0.1.48

type ShortCode struct {
	Item

	Name     string   `json:"name"`
	Desc     string   `json:"desc"`
	Template string   `json:"template"`
	Example  string   `json:"example"`
	Tags     []string `json:"tags"`

	Asset  string `json:"asset"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
}

func (*ShortCode) AfterAPICreate added in v0.1.48

func (s *ShortCode) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*ShortCode) Approve added in v0.1.48

func (s *ShortCode) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*ShortCode) AutoApprove added in v0.1.48

func (s *ShortCode) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*ShortCode) BeforeAPICreate added in v0.1.48

func (s *ShortCode) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*ShortCode) Create added in v0.1.48

func (s *ShortCode) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*ShortCode) GetHeight added in v0.1.48

func (s *ShortCode) GetHeight() int

func (*ShortCode) GetWidth added in v0.1.48

func (s *ShortCode) GetWidth() int

func (*ShortCode) IndexContent added in v0.1.48

func (s *ShortCode) IndexContent() bool

func (*ShortCode) ItemTags added in v0.1.48

func (s *ShortCode) ItemTags() []string

func (*ShortCode) MarshalEditor added in v0.1.48

func (s *ShortCode) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*ShortCode) SetHash added in v0.1.48

func (s *ShortCode) SetHash()

func (*ShortCode) SetMeta added in v0.1.48

func (s *ShortCode) SetMeta(service content.DirService) error

func (*ShortCode) String added in v0.1.48

func (s *ShortCode) String() string

String defines the display name of a Song in the CMS list-view

type Site

type Site struct {
	Item

	Title                  string   `json:"title"`
	Description            string   `json:"description"`
	BaseURL                string   `json:"base_url"`
	Theme                  string   `json:"theme"`
	Params                 string   `json:"params"`
	Owner                  string   `json:"owner"`
	SubDomain              string   `json:"sub_domain,omitempty"`
	WorkingDir             string   `json:"working_dir,omitempty"`
	GoogleAnalytics        string   `json:"google_analytics,omitempty"`
	DefaultContentLanguage string   `json:"default_content_language,omitempty"`
	Languages              []string `json:"languages,omitempty"`
	Menus                  []string `json:"menus,omitempty"`
}

func (*Site) AfterAPICreate

func (s *Site) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Site) Approve

func (s *Site) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Site) AutoApprove

func (s *Site) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Site) BeforeAPICreate

func (s *Site) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Site) Build

func (s *Site) Build() bool

func (*Site) Create

func (s *Site) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Site) Deploy

func (s *Site) Deploy() bool

func (*Site) HasMenus

func (s *Site) HasMenus() bool

func (*Site) IndexContent

func (s *Site) IndexContent() bool

func (*Site) IsMultiLanguages

func (s *Site) IsMultiLanguages() bool

func (*Site) MarshalEditor

func (s *Site) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Site) String

func (s *Site) String() string

String defines the display name of a Song in the CMS list-view

func (*Site) Toml

func (s *Site) Toml() ([]byte, error)

func (*Site) UnmarshalJSON

func (s *Site) UnmarshalJSON(data []byte) error

func (*Site) Update

func (s *Site) Update(res http.ResponseWriter, req *http.Request) error

type SiteLanguage

type SiteLanguage struct {
	Item

	Site     string `json:"site"`
	Language string `json:"language"`
	Default  bool   `json:"default"`
	Folder   string `json:"folder"`
	// contains filtered or unexported fields
}

func (*SiteLanguage) AfterAPICreate

func (s *SiteLanguage) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*SiteLanguage) Approve

func (s *SiteLanguage) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*SiteLanguage) AutoApprove

func (s *SiteLanguage) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*SiteLanguage) BeforeAPICreate

func (s *SiteLanguage) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*SiteLanguage) Create

func (s *SiteLanguage) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*SiteLanguage) IndexContent

func (s *SiteLanguage) IndexContent() bool

func (*SiteLanguage) MarshalEditor

func (s *SiteLanguage) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*SiteLanguage) SelectContentTypes

func (s *SiteLanguage) SelectContentTypes() []string

func (*SiteLanguage) SetSelectData

func (s *SiteLanguage) SetSelectData(data map[string][][]byte)

func (*SiteLanguage) String

func (s *SiteLanguage) String() string

String defines the display name of a Song in the CMS list-view

type SitePost

type SitePost struct {
	Item

	Site string `json:"site"`
	Post string `json:"post"`
	Path string `json:"path"`
	// contains filtered or unexported fields
}

func (*SitePost) AfterAPICreate

func (s *SitePost) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*SitePost) Approve

func (s *SitePost) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*SitePost) AutoApprove

func (s *SitePost) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*SitePost) BeforeAPICreate

func (s *SitePost) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*SitePost) Create

func (s *SitePost) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*SitePost) IndexContent

func (s *SitePost) IndexContent() bool

func (*SitePost) MarshalEditor

func (s *SitePost) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*SitePost) SelectContentTypes

func (s *SitePost) SelectContentTypes() []string

func (*SitePost) SetSelectData

func (s *SitePost) SetSelectData(data map[string][][]byte)

func (*SitePost) String

func (s *SitePost) String() string

String defines the display name of a Song in the CMS list-view

type SiteResource

type SiteResource struct {
	Item

	Site     string `json:"site"`
	Resource string `json:"resource"`
	Path     string `json:"path"`
	// contains filtered or unexported fields
}

func (*SiteResource) AfterAPICreate

func (s *SiteResource) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*SiteResource) Approve

func (s *SiteResource) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*SiteResource) AutoApprove

func (s *SiteResource) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*SiteResource) BeforeAPICreate

func (s *SiteResource) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*SiteResource) Create

func (s *SiteResource) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*SiteResource) IndexContent

func (s *SiteResource) IndexContent() bool

func (*SiteResource) MarshalEditor

func (s *SiteResource) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*SiteResource) SelectContentTypes

func (s *SiteResource) SelectContentTypes() []string

func (*SiteResource) SetSelectData

func (s *SiteResource) SetSelectData(data map[string][][]byte)

func (*SiteResource) String

func (s *SiteResource) String() string

String defines the display name of a Song in the CMS list-view

type SortableContent

type SortableContent []content.Sortable

func (SortableContent) Len

func (s SortableContent) Len() int

func (SortableContent) Less

func (s SortableContent) Less(i, j int) bool

func (SortableContent) Swap

func (s SortableContent) Swap(i, j int)

type SubDomain added in v0.2.3

type SubDomain struct {
	Item

	Sub     string `json:"sub"`
	License string `json:"license"`
}

func (*SubDomain) AfterAPICreate added in v0.2.3

func (d *SubDomain) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

func (*SubDomain) Approve added in v0.2.3

func (d *SubDomain) Approve(res http.ResponseWriter, req *http.Request) error

func (*SubDomain) AutoApprove added in v0.2.3

func (d *SubDomain) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*SubDomain) BeforeAPICreate added in v0.2.3

func (d *SubDomain) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

func (*SubDomain) Create added in v0.2.3

func (d *SubDomain) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*SubDomain) IndexContent added in v0.2.3

func (d *SubDomain) IndexContent() bool

func (*SubDomain) ItemHash added in v0.2.3

func (d *SubDomain) ItemHash() string

func (*SubDomain) ItemSlug added in v0.2.3

func (d *SubDomain) ItemSlug() string

func (*SubDomain) MarshalEditor added in v0.2.3

func (d *SubDomain) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*SubDomain) Name added in v0.2.3

func (d *SubDomain) Name() string

func (*SubDomain) SetHash added in v0.2.3

func (d *SubDomain) SetHash()

func (*SubDomain) SetSlug added in v0.2.3

func (d *SubDomain) SetSlug(slug string)

func (*SubDomain) String added in v0.2.3

func (d *SubDomain) String() string

String defines the display name of a Song in the CMS list-view

type SyncAccount added in v0.2.3

type SyncAccount struct {
	Item

	License    string `json:"license"`     // 关联的 License Key
	Email      string `json:"email"`       // CouchDB 用户邮箱
	DBName     string `json:"db_name"`     // CouchDB 数据库名
	DBPassword string `json:"db_password"` // CouchDB 数据库密码
	DBEndpoint string `json:"db_endpoint"` // CouchDB 数据库端点 URL
	Status     string `json:"status"`      // active / suspended
	CreatedAt  int64  `json:"created_at"`  // 创建时间
}

SyncAccount License 对应的 CouchDB 账号 BoltDB 存储: syncaccount / syncaccount__index Hash: MD5(License) | Slug: {License}

func (*SyncAccount) Approve added in v0.2.3

func (s *SyncAccount) Approve(res http.ResponseWriter, req *http.Request) error

func (*SyncAccount) AutoApprove added in v0.2.3

func (s *SyncAccount) AutoApprove(res http.ResponseWriter, req *http.Request) error

func (*SyncAccount) Create added in v0.2.3

func (s *SyncAccount) Create(res http.ResponseWriter, req *http.Request) error

func (*SyncAccount) IndexContent added in v0.2.3

func (s *SyncAccount) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*SyncAccount) ItemHash added in v0.2.3

func (s *SyncAccount) ItemHash() string

func (*SyncAccount) ItemSlug added in v0.2.3

func (s *SyncAccount) ItemSlug() string

func (*SyncAccount) MarshalEditor added in v0.2.3

func (s *SyncAccount) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*SyncAccount) SetHash added in v0.2.3

func (s *SyncAccount) SetHash()

SetHash 使用 License 的 hash,一个 License 对应一个 SyncAccount 存入 __contentIndex["syncaccount:{hash}"] → ID

func (*SyncAccount) SetSlug added in v0.2.3

func (s *SyncAccount) SetSlug(slug string)

SetSlug 使用 License 作为 slug

func (*SyncAccount) String added in v0.2.3

func (s *SyncAccount) String() string

String 定义在 CMS 列表中的显示名称

type SyncUsage added in v0.2.3

type SyncUsage struct {
	Item

	SyncAccount   string `json:"sync_account"`   // 关联的 SyncAccount (License Key)
	DocumentCount int    `json:"document_count"` // 文档数量
	StorageBytes  int64  `json:"storage_bytes"`  // 存储字节数
	QuotaBytes    int64  `json:"quota_bytes"`    // 配额字节数
	LastSyncAt    int64  `json:"last_sync_at"`   // 最后同步时间
	RecordedAt    int64  `json:"recorded_at"`    // 记录时间
}

SyncUsage Sync 使用量记录 BoltDB 存储: syncusage / syncusage__index Hash: MD5(SyncAccount:RecordedAt) | 用于记录历史使用量

func (*SyncUsage) IndexContent added in v0.2.3

func (u *SyncUsage) IndexContent() bool

IndexContent 标记此类型需要被索引

func (*SyncUsage) IsOverQuota added in v0.2.3

func (u *SyncUsage) IsOverQuota() bool

IsOverQuota 检查是否超出配额

func (*SyncUsage) MarshalEditor added in v0.2.3

func (u *SyncUsage) MarshalEditor() ([]byte, error)

MarshalEditor 实现 editor.Editable 接口

func (*SyncUsage) SetHash added in v0.2.3

func (u *SyncUsage) SetHash()

SetHash 使用 SyncAccount + RecordedAt 的组合 hash 存入 __contentIndex["syncusage:{hash}"] → ID

func (*SyncUsage) SetSlug added in v0.2.3

func (u *SyncUsage) SetSlug(slug string)

SetSlug 使用 "SyncAccount:RecordedAt" 格式

func (*SyncUsage) String added in v0.2.3

func (u *SyncUsage) String() string

String 定义在 CMS 列表中的显示名称

func (*SyncUsage) UsagePercentage added in v0.2.3

func (u *SyncUsage) UsagePercentage() float64

UsagePercentage 计算使用百分比

type Theme

type Theme struct {
	Item

	Name        string   `json:"name"`
	Author      string   `json:"author"`
	Version     string   `json:"version"`
	Screenshot  string   `json:"screenshot"`
	DownloadURL string   `json:"download_url"`
	DemoURL     string   `json:"demo_url"`
	Tags        []string `json:"tags"`
}

func (*Theme) AfterAPICreate

func (s *Theme) AfterAPICreate(res http.ResponseWriter, req *http.Request) error

AfterAPICreate is called after Create, and is useful for logging or triggering notifications, etc. after the data is saved to the database, etc. The request has a context containing the databse 'target' affected by the request. Ex. Song__pending:3 or Song:8 depending if Song implements api.Trustable

func (*Theme) Approve

func (s *Theme) Approve(res http.ResponseWriter, req *http.Request) error

Approve implements editor.Mergeable, which enables content supplied by external clients to be approved and thus added to the public content API. Before content is approved, it is waiting in the Pending bucket, and can only be approved in the CMS if the Mergeable interface is satisfied. If not, you will not see this content show up in the CMS.

func (*Theme) AutoApprove

func (s *Theme) AutoApprove(res http.ResponseWriter, req *http.Request) error

AutoApprove implements api.Trustable, and will automatically approve content that has been submitted by an external client via api.Createable. Be careful when using AutoApprove, because content will immediately be available through your public content API. If the Trustable interface is satisfied, the AfterApprove method is bypassed. The

func (*Theme) BeforeAPICreate

func (s *Theme) BeforeAPICreate(res http.ResponseWriter, req *http.Request) error

BeforeAPICreate is only called if the Song type implements api.Createable It is called before Create, and returning an error will cancel the request causing the system to reject the data sent in the POST

func (*Theme) Create

func (s *Theme) Create(res http.ResponseWriter, req *http.Request) error

Create implements api.Createable, and allows external POST requests from clients to add content as long as the request contains the json tag names of the Song struct fields, and is multipart encoded

func (*Theme) IndexContent

func (s *Theme) IndexContent() bool

func (*Theme) ItemTags added in v0.2.1

func (s *Theme) ItemTags() []string

func (*Theme) MarshalEditor

func (s *Theme) MarshalEditor() ([]byte, error)

MarshalEditor writes a buffer of html to edit a Song within the CMS and implements editor.Editable

func (*Theme) SetHash added in v0.2.1

func (s *Theme) SetHash()

func (*Theme) String

func (s *Theme) String() string

String defines the display name of a Song in the CMS list-view

Jump to

Keyboard shortcuts

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