database

package
v0.0.0-...-1437401 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Database *gorm.DB

Functions

func Setup

func Setup()

Types

type Analytic

type Analytic struct {
	ID           uint           `gorm:"primaryKey" json:"id"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"index" json:"deleted_at"`
	URL          string         `json:"url"`
	RedirectCode string         `json:"redirect_code"`
	Referer      string         `json:"referer"`
	UserAgent    string         `json:"user_agent"`
	Country      string         `json:"country"`
}

type Category

type Category struct {
	ID        uint           `gorm:"primaryKey" json:"id"`
	CreatedAt time.Time      `json:"created_at"`
	UpdatedAt time.Time      `json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"deleted_at"`
	Slug      string         `gorm:"unique" json:"slug"`
	Title     string         `json:"title"`
	Posts     []Post         `gorm:"many2many:post_categories" json:"posts"`
}

type Post

type Post struct {
	ID           uint           `gorm:"primaryKey" json:"id"`
	CreatedAt    time.Time      `json:"created_at"`
	UpdatedAt    time.Time      `json:"updated_at"`
	DeletedAt    gorm.DeletedAt `gorm:"index" json:"deleted_at"`
	Link         string         `json:"link"`
	RedirectCode string         `json:"redirect_code"`
	PostID       string         `gorm:"unique" json:"post_id"`
	Excerpt      string         `json:"excerpt"`
	Title        string         `json:"title"`
	PublishedAt  time.Time      `json:"published_at"`
	Cover        string         `json:"cover"`
	HaveCover    bool           `gorm:"default:false" json:"have_cover"`
	Categories   []Category     `gorm:"many2many:post_categories" json:"categories"`
	Tags         pq.StringArray `gorm:"type:text[]" json:"tags"`
	LastFetched  time.Time      `gorm:"autoUpdateTime" json:"last_fetched"`
	ProviderID   uint           `json:"provider_id"`
}

type Provider

type Provider struct {
	ID                  uint           `gorm:"primaryKey" json:"id"`
	CreatedAt           time.Time      `json:"created_at"`
	UpdatedAt           time.Time      `json:"updated_at"`
	DeletedAt           gorm.DeletedAt `gorm:"index" json:"deleted_at"`
	Name                string         `gorm:"unique" json:"name"`
	AccountType         string         `json:"account_type"`
	ContactEmail        string         `json:"contact_email"`
	AuthorURL           string         `json:"author_url"`
	AuthorDefaultCover  string         `json:"author_default_cover"`
	AuthorDefaultTopics pq.StringArray `gorm:"type:text[]" json:"author_default_topics"`
	Posts               []Post         `gorm:"foreignKey:ProviderID" json:"posts"`
}

type Tags

type Tags []string

func (*Tags) Scan

func (t *Tags) Scan(v interface{}) error

func (*Tags) Value

func (t *Tags) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

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