model

package
v0.0.0-...-be294a2 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2021 License: MIT Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migration

func Migration()

Migration fact-check models

Types

type Claim

type Claim struct {
	config.Base
	Claim           string         `gorm:"column:claim" json:"claim"`
	Slug            string         `gorm:"column:slug" json:"slug"`
	ClaimDate       *time.Time     `gorm:"column:claim_date" json:"claim_date" sql:"DEFAULT:NULL"`
	CheckedDate     *time.Time     `gorm:"column:checked_date" json:"checked_date" sql:"DEFAULT:NULL"`
	ClaimSources    postgres.Jsonb `gorm:"column:claim_sources" json:"claim_sources" swaggertype:"primitive,string"`
	Description     postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HTMLDescription string         `gorm:"column:html_description" json:"html_description,omitempty"`
	ClaimantID      uint           `gorm:"column:claimant_id" json:"claimant_id"`
	Claimant        Claimant       `json:"claimant"`
	RatingID        uint           `gorm:"column:rating_id" json:"rating_id"`
	Rating          Rating         `json:"rating"`
	Fact            string         `gorm:"column:fact" json:"fact"`
	ReviewSources   postgres.Jsonb `gorm:"column:review_sources" json:"review_sources" swaggertype:"primitive,string"`
	MetaFields      postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	SpaceID         uint           `gorm:"column:space_id" json:"space_id"`
	Space           *model.Space   `json:"space,omitempty"`
}

Claim model

func (*Claim) BeforeCreate

func (claim *Claim) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Claim) BeforeSave

func (claim *Claim) BeforeSave(tx *gorm.DB) (e error)

BeforeSave - validation for rating & claimant

type Claimant

type Claimant struct {
	config.Base
	Name            string         `gorm:"column:name" json:"name"`
	Slug            string         `gorm:"column:slug" json:"slug"`
	Description     postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HTMLDescription string         `gorm:"column:html_description" json:"html_description,omitempty"`
	TagLine         string         `gorm:"column:tag_line" json:"tag_line"`
	MediumID        *uint          `gorm:"column:medium_id;default:NULL" json:"medium_id"`
	Medium          *model.Medium  `json:"medium"`
	MetaFields      postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	SpaceID         uint           `gorm:"column:space_id" json:"space_id"`
	Space           *model.Space   `json:"space,omitempty"`
}

Claimant model

func (*Claimant) BeforeCreate

func (claimant *Claimant) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Claimant) BeforeSave

func (claimant *Claimant) BeforeSave(tx *gorm.DB) (e error)

BeforeSave - validation for medium

type PostClaim

type PostClaim struct {
	config.Base
	ClaimID  uint  `gorm:"column:claim_id" json:"claim_id"`
	Claim    Claim `json:"claim"`
	PostID   uint  `gorm:"column:post_id" json:"post_id"`
	Position uint  `gorm:"column:position" json:"position"`
}

PostClaim model

func (*PostClaim) BeforeCreate

func (pc *PostClaim) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

type Rating

type Rating struct {
	config.Base
	Name             string         `gorm:"column:name" json:"name"`
	Slug             string         `gorm:"column:slug" json:"slug"`
	BackgroundColour postgres.Jsonb `gorm:"column:background_colour" json:"background_colour" swaggertype:"primitive,string"`
	TextColour       postgres.Jsonb `gorm:"column:text_colour" json:"text_colour" swaggertype:"primitive,string"`
	Description      postgres.Jsonb `gorm:"column:description" json:"description" swaggertype:"primitive,string"`
	HTMLDescription  string         `gorm:"column:html_description" json:"html_description,omitempty"`
	NumericValue     int            `gorm:"column:numeric_value" json:"numeric_value"`
	MediumID         *uint          `gorm:"column:medium_id;default=NULL" json:"medium_id"`
	Medium           *model.Medium  `json:"medium"`
	MetaFields       postgres.Jsonb `gorm:"column:meta_fields" json:"meta_fields" swaggertype:"primitive,string"`
	SpaceID          uint           `gorm:"column:space_id" json:"space_id"`
	Space            *model.Space   `json:"space,omitempty"`
}

Rating model

func (*Rating) BeforeCreate

func (rating *Rating) BeforeCreate(tx *gorm.DB) error

BeforeCreate hook

func (*Rating) BeforeSave

func (rating *Rating) BeforeSave(tx *gorm.DB) (e error)

BeforeSave - validation for medium

Jump to

Keyboard shortcuts

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