images

package
v1.5.5 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2018 License: MIT Imports: 4 Imported by: 1

Documentation

Overview

Package images represents the image resource

Index

Constants

View Source
const (
	// TableName is the database table for this resource
	TableName = "images"
	// 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 images with status >= published.

func Query

func Query() *query.Query

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

func Where

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

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

Types

type Image

type Image 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
	Name     string
	Path     string
	Sort     int64
}

Image handles saving and retreiving images from the database

func Find

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

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

func FindAll

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

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

func FindFirst

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

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

func New

func New() *Image

New creates and initialises a new image instance.

func NewWithColumns

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

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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