posts

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	gorm.Model
	l10n.Locale
	sorting.Sorting
	Name string `gorm:"index:name"`
	Code string `gorm:"index:code"`

	Categories []Category
	CategoryID uint `gorm:"index:category_id"`
}

func (Category) DefaultPath

func (category Category) DefaultPath() string

func (Category) Validate

func (category Category) Validate(db *gorm.DB)

type Collection

type Collection struct {
	gorm.Model
	Name string `gorm:"index:name"`
	l10n.LocaleCreatable
}

type Comment

type Comment struct {
	gorm.Model
	Content string `gorm:"type:mediumtext" json:"content"`
}

func (*Comment) BeforeCreate

func (c *Comment) BeforeCreate() (err error)

func (Comment) Validate

func (c Comment) Validate(db *gorm.DB)
type Link struct {
	ID       uint `gorm:"primary_key" json:"id"`
	URL      string
	Name     string `gorm:"index:name"`
	Title    string `gorm:"type:mediumtext"`
	ImageUrl string
	PostID   uint
}

func (*Link) BeforeCreate

func (l *Link) BeforeCreate() (err error)

func (Link) Validate

func (l Link) Validate(db *gorm.DB)

type Post

type Post struct {
	gorm.Model
	l10n.Locale
	sorting.SortingDESC
	Name         string    `gorm:"index:name"`
	NameWithSlug slug.Slug `l10n:"sync"`
	Featured     bool
	Code         string   `l10n:"sync" gorm:"index:code"`
	CategoryID   uint     `l10n:"sync" gorm:"index:category_id"`
	Category     Category `l10n:"sync"`
	// Categories []Category `gorm:"many2many:post_categories" l10n:"sync"`
	Collections    []Collection `l10n:"sync" gorm:"many2many:post_collections;"`
	Tags           []Tag        `l10n:"sync" gorm:"many2many:post_tags"`
	Comments       []Comment    `l10n:"sync"`
	Links          []Link       `l10n:"sync"` // gorm:"many2many:post_links"`
	MainImage      media_library.MediaBox
	Images         media_library.MediaBox
	Description    string         `gorm:"type:longtext"`
	Summary        string         `gorm:"type:mediumtext"`
	PostProperties PostProperties `sql:"type:text"`
	Seo            qor_seo.Setting
	publish2.Version
	publish2.Schedule
	publish2.Visible
}

func (Post) DefaultPath

func (post Post) DefaultPath() string

func (Post) GetID

func (post Post) GetID() uint

func (Post) GetSEO

func (post Post) GetSEO() *qor_seo.SEO

func (Post) MainImageURL

func (post Post) MainImageURL(styles ...string) string

func (Post) Validate

func (post Post) Validate(db *gorm.DB)

type PostImage

type PostImage struct {
	gorm.Model
	Title        string
	Category     Category
	CategoryID   uint
	SelectedType string
	File         media_library.MediaLibraryStorage `sql:"size:4294967295;" media_library:"url:/system/{{class}}/{{primary_key}}/{{column}}.{{extension}}"`
}

func (*PostImage) GetMediaOption

func (postImage *PostImage) GetMediaOption() (mediaOption media_library.MediaOption)

func (*PostImage) GetSelectedType

func (postImage *PostImage) GetSelectedType() string

func (*PostImage) ScanMediaOptions

func (postImage *PostImage) ScanMediaOptions(mediaOption media_library.MediaOption) error

func (*PostImage) SetSelectedType

func (postImage *PostImage) SetSelectedType(typ string)

func (PostImage) Validate

func (postImage PostImage) Validate(db *gorm.DB)

type PostProperties

type PostProperties []PostProperty

func (*PostProperties) Scan

func (postProperties *PostProperties) Scan(value interface{}) error

func (PostProperties) Value

func (postProperties PostProperties) Value() (driver.Value, error)

type PostProperty

type PostProperty struct {
	Name  string
	Value string
}

type PostVariation

type PostVariation struct {
	gorm.Model
	PostID   *uint
	Post     Post
	Featured bool
	Images   media_library.MediaBox
}

type Tag

type Tag struct {
	ID           uint            `gorm:"primary_key" json:"id"`
	Name         string          `json:"name" gorm:"index:name"`
	Hashtag      string          `json:"hashtag"`
	NameWithSlug qor_slug.Slug   `l10n:"sync" json:"name_with_slug" gorm:"index:name_with_slug"`
	Seo          qor_seo.Setting `json:"seo"`
	l10n.Locale
	sorting.Sorting
}

func (*Tag) BeforeCreate

func (t *Tag) BeforeCreate() (err error)

func (Tag) DefaultPath

func (t Tag) DefaultPath() string

func (*Tag) SetLanguageCode

func (t *Tag) SetLanguageCode(code string)

func (Tag) Validate

func (t Tag) Validate(db *gorm.DB)

Jump to

Keyboard shortcuts

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