models

package
v0.0.0-...-b495b12 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2017 License: AGPL-3.0 Imports: 9 Imported by: 3

Documentation

Index

Constants

View Source
const (
	NotificationStatusNew = iota
	NotificationStatusRead
	NotificationStatusDismissed
)
View Source
const (
	NotificationTypeComment = iota
	NotificationTypeContact
)

Variables

This section is empty.

Functions

func GenerateSlug

func GenerateSlug(title string) []byte

func GetSettingsMap

func GetSettingsMap() map[string]string

Types

type Authenticable

type Authenticable interface {
	CheckPassword(password string) bool
	Password(password string)
}

type Category

type Category struct {
	Id          int
	Title       string  `orm:"size(100)"`
	Description string  `orm:"type(text)"`
	Posts       []*Post `orm:"reverse(many)"`
}

func (*Category) TableName

func (this *Category) TableName() string

type Comment

type Comment struct {
	Id        int
	Commenter string   `orm:"size(100)"`
	Email     string   `orm:"size(100)"`
	Comment   string   `orm:"type(text)"`
	Post      *Post    `orm:"rel(fk);null"`
	Parent    *Comment `orm:"rel(fk);null"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Comment) TableName

func (this *Comment) TableName() string
type Link struct {
	Id    int
	Title string `orm:"size(100)"`
	Url   string `orm:"size(255)"`
}

func (*Link) TableName

func (this *Link) TableName() string

type Media

type Media struct {
	Id        int
	Filename  string `orm: "size(200)"`
	Type      string `orm: "size(100)"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (Media) TableName

func (this Media) TableName() string

type Notification

type Notification struct {
	Id        int
	Message   string `orm:"size(255)"`
	Type      int64
	Status    int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Notification) TableName

func (this *Notification) TableName() string

type Page

type Page struct {
	Id          int
	Title       string `orm:"size(100)"`
	Tagline     string `orm:"size(100);null"`
	Slug        string `orm:"size(100);null"`
	Content     string `orm:"type(text)"`
	ContentType string `orm:"size(100)"`
	Published   bool   `orm:default(false)`
	Description string `orm:"type(text)"`
	Keywords    string `orm:"size(100)"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Photo       string `orm:"null"`
}

func (*Page) TableName

func (this *Page) TableName() string

type Post

type Post struct {
	Id          int
	Title       string `orm:"size(100)"`
	Tagline     string `orm:"size(100);null"`
	Slug        string `orm:"size(100);null"`
	Content     string `orm:"type(text)"`
	ContentType string `orm:"size(100)"`
	Published   bool   `orm:default(false)`
	Description string `orm:"type(text)"`
	Keywords    string `orm:"size(100)"`
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Photo       string     `orm:"null"`
	Category    *Category  `orm:"rel(fk);null"`
	Author      *User      `orm:"rel(fk)"`
	Comments    []*Comment `orm:"reverse(many)"`
}

func (*Post) TableName

func (this *Post) TableName() string

func (*Post) Url

func (this *Post) Url() string

type Setting

type Setting struct {
	Id    int
	Key   string `orm:"size(100)"`
	Value string `orm:"size(255)"`
}

func GetSetting

func GetSetting(key string) (Setting, error)

func (*Setting) TableName

func (this *Setting) TableName() string

type User

type User struct {
	Id       int
	Username string `orm:"size(100);unique"`
	Password string `orm:"size(100)"`
	Salt     string `orm:"size(10)"`
}

func GetUserByName

func GetUserByName(username string) (user User, err error)

func NewUser

func NewUser(id int) (user User, err error)

func (*User) CheckPassword

func (this *User) CheckPassword(password string) bool

func (*User) SetPassword

func (this *User) SetPassword(password string)

func (*User) TableName

func (this *User) TableName() string

Jump to

Keyboard shortcuts

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