pages

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package pages represents the page resource

Index

Constants

View Source
const (
	// TableName is the database table for this resource
	TableName = "pages"
	// KeyName is the primary key value for this resource
	KeyName = "id"
	// Order defines the default sort order in sql for this resource
	Order = "name asc, id desc"
)

Variables

This section is empty.

Functions

func AllowedParams

func AllowedParams() []string

AllowedParams returns an array of allowed param keys for Update and Create.

func Published

func Published() *query.Query

Published returns a query for all pages with status >= published.

func Query

func Query() *query.Query

Query returns a new query for pages with a default order.

func Where

func Where(format string, args ...interface{}) *query.Query

Where returns a new query for pages with the format and arguments supplied.

Types

type Page

type Page struct {
	// resource.Base defines behaviour and fields shared between all resources
	resource.Base

	// status.ResourceStatus defines a status field and associated behaviour
	status.ResourceStatus

	AuthorID int64
	Keywords string
	Name     string
	Summary  string
	Template string
	Text     string
	URL      string
}

Page handles saving and retreiving pages from the database

func Find

func Find(id int64) (*Page, error)

Find fetches a single page record from the database by id.

func FindAll

func FindAll(q *query.Query) ([]*Page, error)

FindAll fetches all page records matching this query from the database.

func FindFirst

func FindFirst(format string, args ...interface{}) (*Page, error)

FindFirst fetches a single page record from the database using a where query with the format and args provided.

func New

func New() *Page

New creates and initialises a new page instance.

func NewWithColumns

func NewWithColumns(cols map[string]interface{}) *Page

NewWithColumns creates a new page instance and fills it with data from the database cols provided.

func (*Page) ShowTemplate

func (p *Page) ShowTemplate() string

ShowTemplate returns the default template if none is set, or the template selected

func (*Page) ShowURL

func (p *Page) ShowURL() string

ShowURL returns our canonical url for showing the page

func (*Page) TemplateOptions

func (p *Page) TemplateOptions() []helpers.Selectable

TemplateOptions provides a set of options for the templates menu ids are indexes into the templates array above

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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