models

package
v0.0.0-...-992d068 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Infobae  = 1
	LaNacion = 2
	Clarin   = 3
)

Variables

View Source
var NewsSources map[int]string

Functions

func ConnectDatabase

func ConnectDatabase() *gorm.DB

func GetArticlesBySource

func GetArticlesBySource(sourceID int) []string

Types

type Article

type Article struct {
	ID          int `gorm:"primary_key;"`
	Title       string
	Content     string
	Source      int
	URL         string
	Thumbnail   string
	PublishedAt time.Time
	CreatedAt   time.Time
}

func CreateArticle

func CreateArticle(input *Article) (*Article, error)

type Base

type Base struct {
	ID        uuid.UUID `gorm:"type:uuid;primary_key;"`
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time `sql:"index"`
}

func (*Base) BeforeCreate

func (base *Base) BeforeCreate(scope *gorm.Scope) error

Jump to

Keyboard shortcuts

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