models

package
v0.0.0-...-604e467 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OrderState = transition.New(&Order{})
	ItemState  = transition.New(&OrderItem{})
)

Functions

This section is empty.

Types

type Address

type Address struct {
	gorm.Model
	UserID      uint
	ContactName string
	Phone       string
	City        string
	Address1    string
	Address2    string
}

func (Address) Stringify

func (address Address) Stringify() string

type Author

type Author struct {
	gorm.Model
	l10n.Locale
	Name string
}

type Category

type Category struct {
	gorm.Model
	l10n.Locale
	sorting.Sorting
	Name string
}

func (Category) Validate

func (category Category) Validate(db *gorm.DB)

type Chapter

type Chapter struct {
	gorm.Model
	Name    string
	MangaID uint
	Manga   Manga
	Storage ChapterStorage `sql:"type:varchar(4096)"`
}

func (Chapter) DefaultName

func (chapter Chapter) DefaultName() string

func (Chapter) DefaultPath

func (chapter Chapter) DefaultPath() string

func (Chapter) GetPage

func (chapter Chapter) GetPage(page uint) string

func (Chapter) MainImageUrl

func (chapter Chapter) MainImageUrl() string

type ChapterStorage

type ChapterStorage struct {
	media_library.FileSystem
}

func (ChapterStorage) GetURLTemplate

func (ChapterStorage) GetURLTemplate(option *media_library.Option) (path string)

type Character

type Character struct {
	gorm.Model
	l10n.Locale
	Name string
}

type Chart

type Chart struct {
	Total string
	Date  time.Time
}

func GetChartData

func GetChartData(table, start, end string) (res []Chart)

date format 2015-01-23

type FeeSetting

type FeeSetting struct {
	ShippingFee     uint
	GiftWrappingFee uint
	CODFee          uint `gorm:"column:cod_fee"`
	TaxRate         int
}

type Manga

type Manga struct {
	gorm.Model
	l10n.Locale
	sorting.SortingDESC

	Name             string
	NameWithSlug     slug.Slug   `l10n:"sync"`
	CategoryID       uint        `l10n:"sync"`
	Category         Category    `l10n:"sync"`
	Authors          []Author    `l10n:"sync" gorm:"many2many:manga_authors"`
	Characters       []Character `l10n:"sync" gorm:"many2many:manga_characters"`
	Tags             []Tag       `l10n:"sync" gorm:"many2many:manga_tags"`
	PublishedCountry string      `l10n:"sync"`
	Description      string      `sql:"size:2000"`
	Chapters         []Chapter
	Enabled          bool
}

func (Manga) DefaultPath

func (manga Manga) DefaultPath() string

func (Manga) MainImageUrl

func (manga Manga) MainImageUrl() string

func (Manga) Validate

func (manga Manga) Validate(db *gorm.DB)

type Order

type Order struct {
	gorm.Model
	UserID            uint
	User              User
	PaymentAmount     float32
	AbandonedReason   string
	DiscountValue     uint
	TrackingNumber    *string
	ShippedAt         *time.Time
	CancelledAt       *time.Time
	ShippingAddressID uint
	ShippingAddress   Address
	BillingAddressID  uint
	BillingAddress    Address
	OrderItems        []OrderItem
	transition.Transition
}

func (Order) Amount

func (order Order) Amount() (amount float32)

type OrderItem

type OrderItem struct {
	gorm.Model
	OrderID      uint
	Quantity     uint
	Price        float32
	DiscountRate uint
	transition.Transition
}

func (OrderItem) Amount

func (item OrderItem) Amount() float32

type SEOSetting

type SEOSetting struct {
	gorm.Model
	SiteName    string
	DefaultPage seo.Setting
	HomePage    seo.Setting
	MangaPage   seo.Setting `seo:"Name,ID"`
}

type Setting

type Setting struct {
	gorm.Model
	FeeSetting
	location.Location `location:"name:Company Address"`
	l10n.Locale
}

type Store

type Store struct {
	gorm.Model
	Name  string
	Phone string
	Email string
	location.Location
	sorting.Sorting
}

type Tag

type Tag struct {
	gorm.Model
	Name string
	l10n.LocaleCreatable
}

type User

type User struct {
	gorm.Model
	Email     string
	Password  string
	Name      string
	Gender    string
	Role      string
	Addresses []Address
}

func (User) AvailableLocales

func (user User) AvailableLocales() []string

func (User) DisplayName

func (user User) DisplayName() string

Jump to

Keyboard shortcuts

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