model

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2017 License: BSD-3-Clause Imports: 6 Imported by: 39

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMimeType added in v0.10.0

func GetMimeType(file *File) (string, error)

GetMimeType returns the mime type if the given file model.

func IsAudioFile added in v0.10.0

func IsAudioFile(file *File) bool

IsAudioFile returns true if the supplied file model is an audio file.

func IsImage added in v0.10.0

func IsImage(mimetype string) bool

IsImage returns true if the supplied mime type is an image.

func IsImageFile added in v0.10.0

func IsImageFile(file *File) bool

IsImageFile returns true if the supplied file model is an image.

func IsTextFile added in v0.10.0

func IsTextFile(file *File) bool

IsTextFile returns true if the supplied file model is a text file.

func IsVideoFile added in v0.10.0

func IsVideoFile(file *File) bool

IsVideoFile returns true if the supplied file model is a video file.

Types

type File

type File struct {
	dataaccess.File
}

A File represents a file ressource that is associated with an Item.

type GeoInformation

type GeoInformation struct {
	Street    string
	City      string
	Postcode  string
	Country   string
	Latitude  string
	Longitude string
	MapType   string
	Zoom      int
}

type Item

type Item struct {
	Type ItemType

	Title       string
	Description string
	Content     string
	Markdown    string

	Hash string

	MetaData MetaData
	// contains filtered or unexported fields
}

An Item represents a single document.

func NewItem

func NewItem(route route.Route, files []*File, sourceType dataaccess.ItemType) *Item

func (*Item) Files

func (item *Item) Files() []*File

func (*Item) FolderName

func (item *Item) FolderName() string

func (*Item) GetFile

func (item *Item) GetFile(fileRoute route.Route) *File

Get the file which matches the supplied route. Returns nil if there is no matching file.

func (*Item) IsFileCollection

func (item *Item) IsFileCollection() bool

func (*Item) IsPhysical

func (item *Item) IsPhysical() bool

func (*Item) IsVirtual

func (item *Item) IsVirtual() bool

func (*Item) Route

func (item *Item) Route() route.Route

func (*Item) String

func (item *Item) String() string

type ItemType

type ItemType int
const (
	TypeDocument ItemType = iota
	TypePresentation
	TypeRepository
	TypeUnknown
)

func (ItemType) String

func (itemType ItemType) String() string

type MetaData

type MetaData struct {
	Language         string
	CreationDate     time.Time
	LastModifiedDate time.Time
	Tags             []string
	Aliases          []string
	Author           string
	GeoInformation   GeoInformation
}

MetaData defines meta-attributes of repository items.

func NewMetaData

func NewMetaData() *MetaData

NewMetaData creates a new instance of the the MetaData struct.

type SortItemsBy

type SortItemsBy func(item1, item2 *Item) bool

func (SortItemsBy) Sort

func (by SortItemsBy) Sort(items []*Item)

Jump to

Keyboard shortcuts

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