models

package
v0.0.0-...-8c4da4a Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2015 License: GPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Active

func Active(db *gorm.DB) *gorm.DB

func FindBy

func FindBy(field string, value interface{}) func(db *gorm.DB) *gorm.DB

func GetRange

func GetRange(limit int, offset int) func(db *gorm.DB) *gorm.DB

func NewConferenceService

func NewConferenceService(params map[string]interface{}) *conferenceService

func NewEventService

func NewEventService(params map[string]interface{}) *eventService

func NewScopeService

func NewScopeService(params map[string]interface{}) *scopeService

func NewSearchService

func NewSearchService(params map[string]interface{}) *searchService

func NewTagAliasService

func NewTagAliasService(params map[string]interface{}) *tagAliasService

func NewTagService

func NewTagService(params map[string]interface{}) *tagService

func NewUserService

func NewUserService(params map[string]interface{}) *userService

func NewVideoService

func NewVideoService(params map[string]interface{}) *videoService

func Paginate

func Paginate(limit int, page int) func(db *gorm.DB) *gorm.DB

func Unpaginate

func Unpaginate(db *gorm.DB) *gorm.DB

Types

type Conference

type Conference struct {
	Slug        string     `sql:"type:varchar(64)" gorm:"primary_key" binding:"required" json:"slug"`
	Title       string     `sql:"type:text" binding:"required" json:"title"`
	Url         string     `json:"url"`
	Type        *string    `sql:"not null;index" binding:"required" json:"type"`
	Scope       *string    `sql:"not null;index" json:"scope"`
	Description string     `sql:"type:text" json:"description"`
	Events      []Event    `json:"events,omitempty" gorm:"foreignkey:conference_slug"`
	EventsCount uint       `sql:"not null;default:0" json:"events_count"`
	Videos      []Video    `json:"videos,omitempty" gorm:"foreignkey:conference_slug"`
	VideosCount uint       `sql:"not null;default:0" json:"videos_count"`
	Thumbnail   string     `json:"thumbnail"`
	IsActive    *bool      `sql:"not null;index" binding:"required" json:"-"`
	UpdatedAt   time.Time  `json:"updated_at"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty"`
}

type Event

type Event struct {
	ID             uint        `gorm:"primary_key" json:"id"`
	ConferenceSlug *string     `sql:"not null;index" binding:"required" json:"conference_slug"`
	Conference     *Conference `json:"conference,omitempty" gorm:"foreignkey:conference_slug"`
	Scope          *string     `sql:"not null;index" json:"scope" binding:"required"`
	Title          string      `sql:"type:text" binding:"required" json:"title"`
	Description    string      `sql:"type:text" json:"description"`
	Country        string      `sql:"index:idx_country_state_city_address" json:"country"`
	City           string      `sql:"index:idx_country_state_city_address" json:"city"`
	State          string      `sql:"index:idx_country_state_city_address" json:"state"`
	Address        string      `sql:"type:text;index:idx_country_state_city_address" json:"address"`
	Speakers       *[]Speaker  `gorm:"many2many:events_speakers" json:"speakers,omitempty"`
	Videos         *[]Video    `json:"videos,omitempty"`
	VideosCount    uint        `sql:"not null;default:0" json:"videos_count"`
	Thumbnail      string      `json:"thumbnail"`
	IsActive       *bool       `sql:"not null;index" binding:"required" json:"-"`
	StartsAt       *time.Time  `sql:"index" json:"starts_at"`
	UpdatedAt      time.Time   `json:"updated_at"`
	DeletedAt      *time.Time  `json:"deleted_at,omitempty"`
}

type Scope

type Scope struct {
	Slug             string `gorm:"primary_key" json:"slug"`
	Title            string `json:"title"`
	ConferencesCount uint   `json:"conferences_count"`
	VideosCount      uint   `json:"videos_count"`
	EventsCount      uint   `json:"events_count"`
	SpeakersCount    uint   `json:"speakers_count"`
}

type SearchResult

type SearchResult struct {
	Type     string      `json:"type"`
	Resource interface{} `json:"resource"`
}

type Service

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

type Speaker

type Speaker struct {
	ID         uint       `gorm:"primary_key" json:"id"`
	FirstName  *string    `json:"first_name"`
	MiddleName *string    `json:"middle_name"`
	LastName   *string    `json:"last_name"`
	NickName   *string    `json:"nick_name"`
	Photo      string     `json:"photo"`
	Events     []Event    `gorm:"many2many:events_speakers" json:"events,omitempty"`
	Videos     []Video    `gorm:"many2many:videos_speakers" json:"videos,omitempty"`
	DeletedAt  *time.Time `json:"deleted_at,omitempty"`
}

type SpeakerService

type SpeakerService struct {
	Service
}

func (*SpeakerService) Speaker

func (this *SpeakerService) Speaker() (*Speaker, error)

type Tag

type Tag struct {
	Slug        string     `gorm:"primary_key" json:"slug"`
	Videos      []Video    `gorm:"many2many:videos_tags;foreignkey:tag_slug" json:"videos,omitempty"`
	VideosCount uint       `json:"videos_count"`
	DeletedAt   *time.Time `json:"deleted_at,omitempty"`
	TagAliases  []TagAlias `gorm:"foreignkey:tag_slug" json:"-"`
	Aliases     []string   `sql:"-" json:"aliases,omitempty"`
}

type TagAlias

type TagAlias struct {
	ID      uint    `gorm:"primary_key" json:"id"`
	Tag     *Tag    `gorm:"foreignkey:tag_slug" json:"tag,omitempty"`
	TagSlug *string `sql:"not null;index" json:"tag_slug"`
	Title   string  `sql:"not null;index" json:"title"`
}

type User

type User struct {
	ID        uint      `gorm:"primary_key" json:"id"`
	Email     *string   `sql:"not null;index" binding:"required" json:"email"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"created_at"`
}

type Video

type Video struct {
	ID             uint        `gorm:"primary_key" json:"id"`
	Title          *string     `sql:"not null,type:text" binding:"required" json:"title"`
	Url            string      `json:"url"`
	Length         *uint       `json:"length,omitempty"`
	Description    string      `sql:"type:text" json:"description"`
	ConferenceSlug *string     `sql:"not null,index" binding:"required" json:"conference_slug"`
	Conference     *Conference `json:"conference,omitempty" gorm:"foreignkey:conference_slug"`
	Scope          *string     `sql:"not null,index" json:"scope"`
	TagResources   *[]Tag      `gorm:"many2many:videos_tags;associationforeignkey:tag_slug" json:"-"`
	Tags           []string    `sql:"-" json:"tags"`
	Speakers       *[]Speaker  `gorm:"many2many:videos_speakers" json:"speakers,omitempty"`
	EventID        *uint       `sql:"index" json:"event_id"`
	Event          *Event      `json:"event,omitempty" gorm:"foreignkey:event_id"`
	LikesCount     uint        `json:"likes_count"`
	DislikesCount  uint        `json:"likes_count"`
	Rating         float64     `json:"rating"`
	Thumbnail      string      `sql:"type:text" json:"thumbnail"`
	Language       *string     `sql:"type:varchar(2)" json:"language"`
	DeletedAt      *time.Time  `json:"deleted_at,omitempty"`
}

Jump to

Keyboard shortcuts

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