models

package
v0.0.0-...-b46c67b Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2017 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Const names to be retrievable from model code
	PUBLIC  = "public"
	PRIVATE = "private"
)

Variables

View Source
var PathSeparator = fmt.Sprintf("%c", os.PathSeparator)

Functions

This section is empty.

Types

type Album

type Album struct {
	ID              int64    `json:"id" db:"id"`
	Title           string   `json:"title" db:"title"`
	Description     string   `json:"description" db:"description"`
	ViewType        string   `json:"view_type" db:"view_type"`
	MiniatureWidth  uint     `json:"miniature_width" db:"miniatureWidth"`
	MiniatureHeight uint     `json:"miniature_height" db:"miniatureHeight"`
	Photos          []*Photo `db:"-"`
}

func CreateAlbum

func CreateAlbum(db *gorp.DbMap, Title string, Description string, ViewType string) (*Album, error)

Create an icon

func ListAlbums

func ListAlbums(db *gorp.DbMap, ViewType *string) ([]*Album, error)

func LoadAlbumFromID

func LoadAlbumFromID(db *gorp.DbMap, ID int64) (*Album, error)

Load album by ID

func LoadPhotosByDate

func LoadPhotosByDate(db *gorp.DbMap, Year int64, Month int64) (*Album, error)

func (*Album) LoadPhotos

func (a *Album) LoadPhotos(db *gorp.DbMap) error

func (*Album) Valid

func (a *Album) Valid() error

Verify that an album object is valid before creating/updating it

type Photo

type Photo struct {
	ID          int64  `json:"id" db:"id"`
	AlbumId     int64  `json:"album_id" db:"album_id"` // no multi album for now
	LocalPath   string `json:"local_path" db:"local_path"`
	Description string `json:"description" db:"description"`
	Md5Sum      string `json:"md5sum" db:"md5sum"`
	//Time mysql.NullTime `json:"time" db:"time"`
	Time *time.Time `json:"time" db:"time"`
}

func CreatePhoto

func CreatePhoto(db *gorp.DbMap, A *Album, Path string) (*Photo, error)

Create a photo

func LoadPhotoFromMd5

func LoadPhotoFromMd5(db *gorp.DbMap, Md5Sum string) (*Photo, error)

Load album by ID

func (*Photo) Valid

func (p *Photo) Valid() error

Verify that a photo object is valid before creating/updating it

type Populated

type Populated struct {
	Month string `db:"month" json:"month"`
	Year  string `db:"year" json:"year"`
	Full  string `db:"d" json:"full"`
}

func ListPopulatedDates

func ListPopulatedDates(db *gorp.DbMap) ([]*Populated, error)

Jump to

Keyboard shortcuts

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