models

package
v0.0.0-...-fa3d426 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2016 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FormatHTML represents the HTML content format
	FormatHTML = "html"

	// FormatMarkdown represents the Markdown content format
	FormatMarkdown = "md"

	// DefaultFormat is the default content format
	DefaultFormat = FormatHTML
)
View Source
const (
	// PageKindContact represents the contact page
	PageKindContact = "contact"

	// PageKindActivities represents the activities page
	PageKindActivities = "activities"

	// PageKindMembers represents the members page
	PageKindMembers = "members"

	// PageKindPosts represents the contact page
	PageKindPosts = "posts"

	// PageKindEvents represents the contact page
	PageKindEvents = "events"
)
View Source
const (

	// UserStatusPending represents a user that signed up but did not confirmed
	UserStatusPending = "pending"

	// UserStatusActive represents a user that signed up and did confirmed
	UserStatusActive = "active"
)
View Source
const (
	// FileMembership represents a membership file kind
	FileMembership = "membership"
)

Variables

View Source
var Derivatives []*Derivative

Derivatives represents a list of image derivatives

View Source
var FileKinds = []string{FileMembership}

FileKinds all possible file kinds

View Source
var SitePagesSettingsKinds map[string]bool

SitePagesSettingsKinds holds all possible page settings kinds

Functions

func IsDerivativePath

func IsDerivativePath(path string) bool

IsDerivativePath returns true if given path is an image derivative

func IsValidFileKind

func IsValidFileKind(kind string) bool

IsValidFileKind returns true if argument is a file kind

func MongoDBSessionForURI

func MongoDBSessionForURI(uri string) *mgo.Session

MongoDBSessionForURI returns a new mongodb session with given uri

func NewMongoDBSession

func NewMongoDBSession() *mgo.Session

NewMongoDBSession returns a new mongodb session

Types

type ActivitiesList

type ActivitiesList []*Activity

ActivitiesList holds a list of Activity

type Activity

type Activity struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`

	Title   string        `bson:"title"           json:"title"`
	Summary string        `bson:"summary"         json:"summary"`
	Body    string        `bson:"body"            json:"body"`
	Cover   bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"`
	// contains filtered or unexported fields
}

Activity represents an activity

func (*Activity) Delete

func (activity *Activity) Delete() error

Delete deletes activity from database

func (*Activity) FindCover

func (activity *Activity) FindCover() *Image

FindCover fetches activity cover

func (*Activity) FindSite

func (activity *Activity) FindSite() *Site

FindSite fetches the site that activity belongs to

func (*Activity) Update

func (activity *Activity) Update(newActivity *Activity) (bool, error)

Update updates activity in database

type DBSession

type DBSession struct {
	// contains filtered or unexported fields
}

DBSession represents a database session

func NewDBSession

func NewDBSession() *DBSession

NewDBSession instanciates a new DBSession

func (*DBSession) ActivitiesCol

func (session *DBSession) ActivitiesCol() *mgo.Collection

ActivitiesCol returns the activities collection

func (*DBSession) Close

func (session *DBSession) Close()

Close closes the database session

func (*DBSession) Copy

func (session *DBSession) Copy() *DBSession

Copy returns a copy of database session

func (*DBSession) CreateActivity

func (session *DBSession) CreateActivity(activity *Activity) error

CreateActivity persists a new activity in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on activity record

func (*DBSession) CreateEvent

func (session *DBSession) CreateEvent(event *Event) error

CreateEvent creates a new event in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on event record

func (*DBSession) CreateFile

func (session *DBSession) CreateFile(f *File) error

CreateFile creates a new file in database

func (*DBSession) CreateImage

func (session *DBSession) CreateImage(img *Image) error

CreateImage creates a new image in database

func (*DBSession) CreateMember

func (session *DBSession) CreateMember(member *Member) error

CreateMember creates a new member in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on member record

func (*DBSession) CreatePage

func (session *DBSession) CreatePage(page *Page) error

CreatePage creates a new page in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on page record

func (*DBSession) CreatePost

func (session *DBSession) CreatePost(post *Post) error

CreatePost creates a new post in database Side effect: 'Id', 'CreatedAt' and 'UpdatedAt' fields are set on post record

func (*DBSession) CreateSite

func (session *DBSession) CreateSite(site *Site) error

CreateSite creates a new site in database Side effect: 'CreatedAt' and 'UpdatedAt' fields are set on site record

func (*DBSession) CreateUser

func (session *DBSession) CreateUser(user *User) error

CreateUser creates a new user in database Side effect: 'CreatedAt' and 'UpdatedAt' fields are set on user record

func (*DBSession) DB

func (session *DBSession) DB() *mgo.Database

DB returns a database handler

func (*DBSession) DBName

func (session *DBSession) DBName() string

DBName returns database name

func (*DBSession) EnsureActivitiesIndexes

func (session *DBSession) EnsureActivitiesIndexes()

EnsureActivitiesIndexes ensures indexes on activities collection

func (*DBSession) EnsureEventsIndexes

func (session *DBSession) EnsureEventsIndexes()

EnsureEventsIndexes ensures indexes on events collection

func (*DBSession) EnsureFilesIndexes

func (session *DBSession) EnsureFilesIndexes()

EnsureFilesIndexes ensure indexes on files collection

func (*DBSession) EnsureImagesIndexes

func (session *DBSession) EnsureImagesIndexes()

EnsureImagesIndexes ensures indexes on images collection

func (*DBSession) EnsureIndexes

func (session *DBSession) EnsureIndexes()

EnsureIndexes ensures indexes on all collections

func (*DBSession) EnsureMembersIndexes

func (session *DBSession) EnsureMembersIndexes()

EnsureMembersIndexes ensure indexes on members collection

func (*DBSession) EnsurePagesIndexes

func (session *DBSession) EnsurePagesIndexes()

EnsurePagesIndexes ensure indexes on pages collection

func (*DBSession) EnsurePostsIndexes

func (session *DBSession) EnsurePostsIndexes()

EnsurePostsIndexes ensures indexes on posts collection

func (*DBSession) EnsureSitesIndexes

func (session *DBSession) EnsureSitesIndexes()

EnsureSitesIndexes ensures indexes on sites collection

func (*DBSession) EnsureUsersIndexes

func (session *DBSession) EnsureUsersIndexes()

EnsureUsersIndexes ensures indexes on users collection

func (*DBSession) EventsCol

func (session *DBSession) EventsCol() *mgo.Collection

EventsCol returns the events collection

func (*DBSession) FilesCol

func (session *DBSession) FilesCol() *mgo.Collection

FilesCol returns files collection

func (*DBSession) FindActivity

func (session *DBSession) FindActivity(activityID bson.ObjectId) *Activity

FindActivity finds an activity by id

func (*DBSession) FindEvent

func (session *DBSession) FindEvent(eventID bson.ObjectId) *Event

FindEvent finds an event by id

func (*DBSession) FindFile

func (session *DBSession) FindFile(fileID bson.ObjectId) *File

FindFile finds a file by id

func (*DBSession) FindImage

func (session *DBSession) FindImage(imageID bson.ObjectId) *Image

FindImage finds an image by id

func (*DBSession) FindMember

func (session *DBSession) FindMember(memberID bson.ObjectId) *Member

FindMember finds member by id

func (*DBSession) FindPage

func (session *DBSession) FindPage(pageID bson.ObjectId) *Page

FindPage finds a page by id

func (*DBSession) FindPost

func (session *DBSession) FindPost(postID bson.ObjectId) *Post

FindPost finds a post by id

func (*DBSession) FindSite

func (session *DBSession) FindSite(siteID string) *Site

FindSite finds a site by id

func (*DBSession) FindUser

func (session *DBSession) FindUser(userID string) *User

FindUser finds a user by id

func (*DBSession) FindUserByEmail

func (session *DBSession) FindUserByEmail(email string) *User

FindUserByEmail finds a user by email

func (*DBSession) ImagesCol

func (session *DBSession) ImagesCol() *mgo.Collection

ImagesCol returns images collection

func (*DBSession) MembersCol

func (session *DBSession) MembersCol() *mgo.Collection

MembersCol returns members collection

func (*DBSession) PagesCol

func (session *DBSession) PagesCol() *mgo.Collection

PagesCol returns pages collection

func (*DBSession) PostsCol

func (session *DBSession) PostsCol() *mgo.Collection

PostsCol returns posts collection

func (*DBSession) RemoveImageReferencesFromActivities

func (session *DBSession) RemoveImageReferencesFromActivities(image *Image) error

RemoveImageReferencesFromActivities removes all references to given image from all activities

func (*DBSession) RemoveImageReferencesFromEvents

func (session *DBSession) RemoveImageReferencesFromEvents(image *Image) error

RemoveImageReferencesFromEvents remove all references to given image from all events

func (*DBSession) RemoveImageReferencesFromMembers

func (session *DBSession) RemoveImageReferencesFromMembers(image *Image) error

RemoveImageReferencesFromMembers removes all references to given image from all members

func (*DBSession) RemoveImageReferencesFromPages

func (session *DBSession) RemoveImageReferencesFromPages(image *Image) error

RemoveImageReferencesFromPages removes all references to given image from all pages

func (*DBSession) RemoveImageReferencesFromPosts

func (session *DBSession) RemoveImageReferencesFromPosts(image *Image) error

RemoveImageReferencesFromPosts removes all references to given image from all posts

func (*DBSession) RemoveImageReferencesFromSitePageSettings

func (session *DBSession) RemoveImageReferencesFromSitePageSettings(image *Image) error

RemoveImageReferencesFromSitePageSettings removes all references to given image from site page settings

func (*DBSession) SetDBName

func (session *DBSession) SetDBName(name string)

SetDBName sets database name

func (*DBSession) SitesCol

func (session *DBSession) SitesCol() *mgo.Collection

SitesCol returns the sites collection

func (*DBSession) UsersCol

func (session *DBSession) UsersCol() *mgo.Collection

UsersCol returns the users collection

type Derivative

type Derivative struct {
	// contains filtered or unexported fields
}

Derivative represents an image derivative

func DerivativeForKind

func DerivativeForKind(kind string) *Derivative

DerivativeForKind returns a derivative definition

type Event

type Event struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`

	StartDate time.Time     `bson:"start_date"      json:"startDate,omitempty"`
	EndDate   time.Time     `bson:"end_date"        json:"endDate,omitempty"`
	Title     string        `bson:"title"           json:"title"`
	Body      string        `bson:"body"            json:"body"`
	Format    string        `bson:"format"          json:"format"`
	Place     string        `bson:"place"           json:"place"`
	Cover     bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"`
	// contains filtered or unexported fields
}

Event represents an event

func (*Event) Delete

func (event *Event) Delete() error

Delete deletes event from database

func (*Event) FindCover

func (event *Event) FindCover() *Image

FindCover fetches cover from database

func (*Event) FindSite

func (event *Event) FindSite() *Site

FindSite fetch site that event belongs to

func (*Event) Update

func (event *Event) Update(newEvent *Event) (bool, error)

Update updates event in database

type EventsList

type EventsList []*Event

EventsList represents a list of events

type File

type File struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`

	Kind string `bson:"kind" json:"kind"`
	Path string `bson:"path" json:"-"`    // this is the effective file path
	Name string `bson:"name" json:"name"` // this is the uploaded file name (may be different from Path)
	Size int64  `bson:"size" json:"size"`
	Type string `bson:"type" json:"type"` // content type
	// contains filtered or unexported fields
}

File represents a file

func (*File) Delete

func (f *File) Delete() error

Delete deletes file from database

func (*File) FilePath

func (f *File) FilePath() string

FilePath returns file path

func (*File) FindSite

func (f *File) FindSite() *Site

FindSite fetches site that file belongs to

func (*File) MarshalJSON

func (f *File) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*File) URL

func (f *File) URL() string

URL returns file URL

type FileJSON

type FileJSON struct {
	File
	URL string `json:"url"`
}

FileJSON represents the json version of a file

type FilesList

type FilesList []*File

FilesList represents a list of files

type Image

type Image struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`
	Path      string        `bson:"path"          json:"-"`    // this is the effective image path
	Name      string        `bson:"name"          json:"name"` // this is the uploaded file name (may be different from Path)
	Size      int64         `bson:"size"          json:"size"`
	Type      string        `bson:"type"          json:"type"` // jpeg | png
	// contains filtered or unexported fields
}

Image represents an image

func (*Image) Delete

func (img *Image) Delete() error

Delete deletes image from database

func (*Image) DerivativeFilePath

func (img *Image) DerivativeFilePath(derivative *Derivative) string

DerivativeFilePath returns given derivative file path

func (*Image) DerivativePath

func (img *Image) DerivativePath(derivative *Derivative) string

DerivativePath returns given derivative path

func (*Image) DerivativeURL

func (img *Image) DerivativeURL(derivative *Derivative) string

DerivativeURL returns given derivative URL

func (*Image) FindSite

func (img *Image) FindSite() *Site

FindSite fetches site that image belongs to

func (*Image) GenerateDerivatives

func (img *Image) GenerateDerivatives(force bool) error

GenerateDerivatives generates all derivatives that were not generated yet

func (*Image) LargePath

func (img *Image) LargePath() string

LargePath returns Large derivative path

func (*Image) LargeURL

func (img *Image) LargeURL() string

LargeURL returns Large derivative URL

func (*Image) MarshalJSON

func (img *Image) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*Image) Original

func (img *Image) Original() *image.Image

Original returns memoized image original image

func (*Image) OriginalFilePath

func (img *Image) OriginalFilePath() string

OriginalFilePath returns file path to original image

func (*Image) PortraitFillPath

func (img *Image) PortraitFillPath() string

PortraitFillPath returns PortraitFill derivative path

func (*Image) PortraitFillURL

func (img *Image) PortraitFillURL() string

PortraitFillURL returns Portrait Fill derivative URL

func (*Image) SmallFillPath

func (img *Image) SmallFillPath() string

SmallFillPath returns SmallFill derivative path

func (*Image) SmallFillURL

func (img *Image) SmallFillURL() string

SmallFillURL returns Small Fill derivative URL

func (*Image) SmallPath

func (img *Image) SmallPath() string

SmallPath returns Small derivative path

func (*Image) SmallURL

func (img *Image) SmallURL() string

SmallURL returns Small derivative URL

func (*Image) SquarePath

func (img *Image) SquarePath() string

SquarePath returns Square derivative path

func (*Image) SquareURL

func (img *Image) SquareURL() string

SquareURL returns Square derivative URL

func (*Image) ThumbPath

func (img *Image) ThumbPath() string

ThumbPath returns Thumb derivative path

func (*Image) ThumbURL

func (img *Image) ThumbURL() string

ThumbURL returns Thumb derivative URL

func (*Image) URL

func (img *Image) URL() string

URL returns image URL

type ImageJSON

type ImageJSON struct {
	Image
	URL string `json:"url"`

	ThumbURL        string `json:"thumbUrl"`
	SquareURL       string `json:"squareUrl"`
	SmallURL        string `json:"smallUrl"`
	SmallFillURL    string `json:"smallFillUrl"`
	PortraitFillURL string `json:"portraitFillUrl"`
	LargeURL        string `json:"largeUrl"`
}

ImageJSON represents the json version of an image

type ImagesList

type ImagesList []*Image

ImagesList represents an list of images

type Member

type Member struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`

	Fullname    string        `bson:"fullname"        json:"fullname"`
	Role        string        `bson:"role"            json:"role"`
	Description string        `bson:"description"     json:"description"`
	Photo       bson.ObjectId `bson:"photo,omitempty" json:"photo,omitempty"`
	Order       int           `bson:"order"           json:"order"`
	// contains filtered or unexported fields
}

Member represents a member

func (*Member) Delete

func (member *Member) Delete() error

Delete deletes member from database

func (*Member) FindPhoto

func (member *Member) FindPhoto() *Image

FindPhoto fetches Photo from database

func (*Member) FindSite

func (member *Member) FindSite() *Site

FindSite fetches site that member belongs to

func (*Member) Update

func (member *Member) Update(newMember *Member) (bool, error)

Update updates member in database

type MembersList

type MembersList []*Member

MembersList represents a list of Member

type Page

type Page struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`

	Title   string        `bson:"title"           json:"title"`
	Tagline string        `bson:"tagline"         json:"tagline"`
	Body    string        `bson:"body"            json:"body"`
	Format  string        `bson:"format"          json:"format"`
	Cover   bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"`

	InNavBar bool `bson:"in_nav_bar" json:"inNavBar"`
	// contains filtered or unexported fields
}

Page represents a page

func (*Page) Delete

func (page *Page) Delete() error

Delete page from database

func (*Page) FindCover

func (page *Page) FindCover() *Image

FindCover fetches cover from database

func (*Page) FindSite

func (page *Page) FindSite() *Site

FindSite fetches site that page belongs to

func (*Page) Update

func (page *Page) Update(newPage *Page) (bool, error)

Update page in database

type PagesList

type PagesList []*Page

PagesList represents a list of pages

type Post

type Post struct {
	ID        bson.ObjectId `bson:"_id,omitempty" json:"id,omitempty"`
	CreatedAt time.Time     `bson:"created_at"    json:"createdAt"`
	UpdatedAt time.Time     `bson:"updated_at"    json:"updatedAt"`
	SiteID    string        `bson:"site_id"       json:"site"`

	Published   bool          `bson:"published"       json:"published"`
	PublishedAt time.Time     `bson:"published_at"    json:"publishedAt,omitempty"`
	Title       string        `bson:"title"           json:"title"`
	Body        string        `bson:"body"            json:"body"`
	Format      string        `bson:"format"          json:"format"`
	Cover       bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"`
	// contains filtered or unexported fields
}

Post represents a post

func (*Post) Delete

func (post *Post) Delete() error

Delete deletes post from database

func (*Post) FindCover

func (post *Post) FindCover() *Image

FindCover fetches cover from database

func (*Post) FindSite

func (post *Post) FindSite() *Site

FindSite fetches site that post belongs to

func (*Post) Update

func (post *Post) Update(newPost *Post) (bool, error)

Update updates post in database

type PostsList

type PostsList []*Post

PostsList represents a list of posts

type Site

type Site struct {
	ID        string    `bson:"_id,omitempty"         json:"id"`
	CreatedAt time.Time `bson:"created_at"            json:"createdAt"`
	UpdatedAt time.Time `bson:"updated_at"            json:"updatedAt"`
	ChangedAt time.Time `bson:"changed_at,omitempty"  json:"changedAt,omitempty"`
	BuiltAt   time.Time `bson:"built_at,omitempty"    json:"builtAt,omitempty"`
	UserID    string    `bson:"user_id"               json:"user"`
	Lang      string    `bson:"lang"                  json:"lang"`
	TZ        string    `bson:"tz"                    json:"tz"`

	Name        string `bson:"name"        json:"name"`
	Tagline     string `bson:"tagline"     json:"tagline"`
	Description string `bson:"description" json:"description"`
	MoreDesc    string `bson:"more_desc"   json:"moreDesc"`
	JoinText    string `bson:"join_text"   json:"joinText"`

	Email   string `bson:"email"   json:"email"`
	Address string `bson:"address" json:"address"`

	Facebook   string `bson:"facebook"    json:"facebook"`
	Twitter    string `bson:"twitter"     json:"twitter"`
	GooglePlus string `bson:"google_plus" json:"googlePlus"`

	GoogleAnalytics string `bson:"google_analytics" json:"googleAnalytics"`

	// images
	Cover   bson.ObjectId `bson:"cover,omitempty"   json:"cover,omitempty"`
	Favicon bson.ObjectId `bson:"favicon,omitempty" json:"favicon,omitempty"`

	// files
	Membership bson.ObjectId `bson:"membership,omitempty" json:"membership,omitempty"`

	PageSettings  map[string]*SitePageSettings  `bson:"page_settings" json:"-"`
	ThemeSettings map[string]*SiteThemeSettings `bson:"theme_settings" json:"-"`

	// build settings
	Theme        string `bson:"theme"         json:"theme"`
	Domain       string `bson:"domain"        json:"domain"`
	CustomDomain string `bson:"custom_domain" json:"customDomain"`
	CustomURL    string `bson:"custom_url"    json:"customUrl"`
	UglyURL      bool   `bson:"ugly_url"      json:"uglyUrl"`

	// theme settings
	NameInNavBar bool `bson:"name_in_navbar" json:"nameInNavBar"`
	// contains filtered or unexported fields
}

Site represents a site

func (*Site) ActivitiesNb

func (site *Site) ActivitiesNb() int

ActivitiesNb returns the total number of activities

func (*Site) BaseUrl

func (site *Site) BaseUrl() string

BaseUrl returns base URL for that site.

func (*Site) BuildDir

func (site *Site) BuildDir() string

BuildDir returns build directory for that site.

func (*Site) Delete

func (site *Site) Delete() error

Delete site from database

func (*Site) DeleteFields

func (site *Site) DeleteFields(fields []string) error

DeleteFields delete given site fields from database

func (*Site) EventsNb

func (site *Site) EventsNb() int

EventsNb returns the total number of events

func (*Site) FilesNb

func (site *Site) FilesNb() int

FilesNb returns the total number of files

func (*Site) FindActivities

func (site *Site) FindActivities(skip int, limit int) *ActivitiesList

FindActivities fetches activities belonging to site

func (*Site) FindAllActivities

func (site *Site) FindAllActivities() *ActivitiesList

FindAllActivities fetches all activities belonging to site

func (*Site) FindAllEvents

func (site *Site) FindAllEvents() *EventsList

FindAllEvents fetches all events belonging to site

func (*Site) FindAllFiles

func (site *Site) FindAllFiles() *FilesList

FindAllFiles fetches all files belonging to site

func (*Site) FindAllImages

func (site *Site) FindAllImages() *ImagesList

FindAllImages fetches all images belonging to site

func (*Site) FindAllMembers

func (site *Site) FindAllMembers() *MembersList

FindAllMembers fetches all members belonging to site

func (*Site) FindAllPages

func (site *Site) FindAllPages() *PagesList

FindAllPages fetches all pages belonging to site

func (*Site) FindAllPosts

func (site *Site) FindAllPosts() *PostsList

FindAllPosts fetches all posts belonging to site

func (*Site) FindCover

func (site *Site) FindCover() *Image

FindCover fetches cover from database

func (*Site) FindEvents

func (site *Site) FindEvents(skip int, limit int) *EventsList

FindEvents fetches events belonging to site

func (*Site) FindFavicon

func (site *Site) FindFavicon() *Image

FindFavicon fetches favicon from database

func (*Site) FindFiles

func (site *Site) FindFiles(skip int, limit int) *FilesList

FindFiles fetches files belonging to site

func (*Site) FindImages

func (site *Site) FindImages(skip int, limit int) *ImagesList

FindImages fetches images belonging to site

func (site *Site) FindLogo() *Image

FindLogo fetches logo from database

func (*Site) FindMembers

func (site *Site) FindMembers(skip int, limit int) *MembersList

FindMembers fetches members belonging to site

func (*Site) FindMembership

func (site *Site) FindMembership() *File

FindMembership fetches membership from database

func (*Site) FindPageSettingsCover

func (site *Site) FindPageSettingsCover(settingKind string) *Image

FindPageSettingsCover fetches page settings cover from database

func (*Site) FindPages

func (site *Site) FindPages(skip int, limit int) *PagesList

FindPages fetches pages belonging to site

func (*Site) FindPosts

func (site *Site) FindPosts(skip int, limit int, onlyPub bool) *PostsList

FindPosts fetches posts belonging to site

func (*Site) FindPublishedPosts

func (site *Site) FindPublishedPosts() *PostsList

FindPublishedPosts fetches all published posts belonging to site

func (*Site) ImagesNb

func (site *Site) ImagesNb() int

ImagesNb returns the total number of images

func (*Site) MarshalJSON

func (site *Site) MarshalJSON() ([]byte, error)

MarshalJSON implements json.MarshalJSON

func (*Site) MembersNb

func (site *Site) MembersNb() int

MembersNb returns the total number of members

func (*Site) PagesNb

func (site *Site) PagesNb() int

PagesNb returns the total number of pages

func (*Site) PostsNb

func (site *Site) PostsNb() int

PostsNb returns the total number of posts

func (*Site) RemoveFileReferences

func (site *Site) RemoveFileReferences(file *File) error

RemoveFileReferences removes all references to given file from database

func (*Site) RemoveImageReferences

func (site *Site) RemoveImageReferences(image *Image) error

RemoveImageReferences removes all references to given image from database

func (*Site) SetBuiltAt

func (site *Site) SetBuiltAt(value time.Time) error

SetBuiltAt sets the BuiltAt value

func (*Site) SetChangedAt

func (site *Site) SetChangedAt(value time.Time) error

SetChangedAt sets the ChangedAt value

func (*Site) SetMembership

func (site *Site) SetMembership(value bson.ObjectId) error

SetMembership sets the Membership value

func (*Site) SetPageSettings

func (site *Site) SetPageSettings(settings *SitePageSettings) error

SetPageSettings inserts (or updates) page settings to database Side effect: 'Id' field is set on record if not already present, and string fields are trimed

func (*Site) SetThemeSettings

func (site *Site) SetThemeSettings(settings *SiteThemeSettings) error

SetThemeSettings inserts (or updates) theme settings to database Side effect: 'Id' field is set on record if not already present, and string fields are trimed

func (*Site) SetValues

func (site *Site) SetValues(values bson.M) error

SetValues sets given site fields in database

func (*Site) TZLocation

func (site *Site) TZLocation() *time.Location

TZLocation returns timezone Location

func (*Site) Update

func (site *Site) Update(newSite *Site) (bool, error)

Update updates site in database

func (*Site) UpdateMemberOrder

func (site *Site) UpdateMemberOrder(id bson.ObjectId, order int)

UpdateMemberOrder updates a member order in database

type SiteJSON

type SiteJSON struct {
	Site
	Links map[string]interface{} `json:"links"`

	// overrides the PageSettings and ThemeSettings fields to provide an array
	// of ids (as needed by Ember Data) instead of a hash of embedded documents
	PageSettings  []string `json:"pageSettings,omitempty"`
	ThemeSettings []string `json:"themeSettings,omitempty"`
}

SiteJSON represents the json version of a site

type SitePageSettings

type SitePageSettings struct {
	ID       bson.ObjectId `bson:"_id,omitempty"   json:"id"`
	Kind     string        `bson:"kind"            json:"kind"` // cf. SitePagesSettingsKinds
	Title    string        `bson:"title"           json:"title"`
	Tagline  string        `bson:"tagline"         json:"tagline"`
	Cover    bson.ObjectId `bson:"cover,omitempty" json:"cover,omitempty"`
	Disabled bool          `bson:"disabled"        json:"disabled"`
}

SitePageSettings represents all the settings for a built-in page

type SiteThemeSettings

type SiteThemeSettings struct {
	ID      bson.ObjectId     `bson:"_id,omitempty" json:"id"`
	Palette string            `bson:"palette,omitempty" json:"palette"`
	Custom  map[string]string `bson:"custom,omitempty" json:"-"`
	Theme   string            `bson:"-" json:"theme"`
}

SiteThemeSettings represents settings for given theme

func (*SiteThemeSettings) MarshalJSON

func (settings *SiteThemeSettings) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

type SiteThemeSettingsJSON

type SiteThemeSettingsJSON struct {
	SiteThemeSettings

	// overrides the Custom field to provide a JSON string instead of an array of embedded documents
	Custom string `json:"custom,omitempty"`
}

SiteThemeSettingsJSON is the JSON representation of SiteThemeSettings

type SitesList

type SitesList []*Site

SitesList represents a list of sites

type User

type User struct {
	ID          string    `bson:"_id,omitempty" json:"id"`
	CreatedAt   time.Time `bson:"created_at"    json:"createdAt"`
	UpdatedAt   time.Time `bson:"updated_at"    json:"updatedAt"`
	ValidatedAt time.Time `bson:"validated_at"  json:"validatedAt"`
	Admin       bool      `bson:"admin"         json:"admin"`
	Status      string    `bson:"status"        json:"status"`

	Email     string `bson:"email"      json:"email"`
	FirstName string `bson:"first_name" json:"firstName"`
	LastName  string `bson:"last_name"  json:"lastName"`
	Lang      string `bson:"lang"       json:"lang"`
	TZ        string `bson:"tz"         json:"tz"`
	Password  string `bson:"password"   json:"-"`
	// contains filtered or unexported fields
}

User represents a user

func (*User) AccountValidated

func (user *User) AccountValidated() bool

AccountValidated returns true if user account has been validated

func (*User) Active

func (user *User) Active() bool

Active returns true if user have an active account

func (*User) DisplayName

func (user *User) DisplayName() string

DisplayName returns user display name, usefull if fullname is empty

func (*User) FindSites

func (user *User) FindSites() *SitesList

FindSites fetche all active sites belonging to user

func (*User) FullName

func (user *User) FullName() string

FullName returns user fullname

func (*User) MailAddress

func (user *User) MailAddress() string

MailAddress returns user mail address with format: User Name <email@addre.ss>

func (*User) MarshalJSON

func (user *User) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*User) SetAccountValidated

func (user *User) SetAccountValidated() error

SetAccountValidated sets user account as validated

func (*User) SetValues

func (user *User) SetValues(values bson.M) error

SetValues sets given user fields values in database

func (*User) Update

func (user *User) Update(newUser *User) (bool, error)

Update updates user in database

type UserJSON

type UserJSON struct {
	User
	Links map[string]interface{} `json:"links"`
}

UserJSON represents the json version of a user

type UsersList

type UsersList []*User

UsersList represents a list of users

Jump to

Keyboard shortcuts

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