valueobject

package
v0.0.0-...-106d939 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: Apache-2.0 Imports: 10 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

Types

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"`
	Timestamp int64          `json:"timestamp"`
	Updated   int64          `json:"updated"`
}

Item should only be embedded into content type structs.

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

type Song

type Song struct {
	Item

	Student    string `json:"student"`
	Title      string `json:"title"`
	Artist     string `json:"artist"`
	Rating     int    `json:"rating"`
	Opinion    string `json:"opinion"`
	SpotifyURL string `json:"spotify_url"`
	Assets     string `json:"assets"`
}

func (*Song) AfterAPICreate

func (s *Song) 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 (*Song) Approve

func (s *Song) 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 (*Song) AutoApprove

func (s *Song) 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 (*Song) BeforeAPICreate

func (s *Song) 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 (*Song) Create

func (s *Song) 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 (*Song) IndexContent

func (s *Song) IndexContent() bool

func (*Song) MarshalEditor

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

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

func (*Song) Push

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

func (*Song) String

func (s *Song) 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 Student

type Student struct {
	Item

	Name string `json:"name"`
}

func (*Student) Approve

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

func (*Student) Create

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

func (*Student) MarshalEditor

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

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

func (*Student) String

func (a *Student) String() string

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

Jump to

Keyboard shortcuts

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