database

package
v0.0.0-...-6cf12d6 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func New

func New(databaseURL string) (*DB, error)

func (*DB) Close

func (d *DB) Close()

func (*DB) Count

func (d *DB) Count() (int64, error)

func (*DB) Create

func (d *DB) Create(e *Entry) error

func (*DB) Delete

func (d *DB) Delete(repo string) error

func (*DB) Get

func (d *DB) Get(repo string) (*Entry, error)

func (*DB) GetAllWithStatus

func (d *DB) GetAllWithStatus(status Status) ([]Entry, error)

func (*DB) Update

func (d *DB) Update(e *Entry) error

type Entry

type Entry struct {
	ID              uint      `gorm:"column:id;primary_key"`
	CreatedAt       time.Time `gorm:"column:created_at;DEFAULT:CURRENT_TIMESTAMP"`
	UpdatedAt       time.Time `gorm:"column:updated_at;DEFAULT:CURRENT_TIMESTAMP"`
	Repository      string    `gorm:"column:repository;type:varchar(255);unique_index"`
	LastGeneratedAt time.Time `gorm:"column:last_generated_at;DEFAULT:CURRENT_TIMESTAMP"`
	LastRequestedAt time.Time `gorm:"column:last_requested_at;DEFAULT:CURRENT_TIMESTAMP"`
	Status          Status    `gorm:"column:status"`
	Stats           Stats     `gorm:"column:stats;type:JSONB"`
}

type Measure

type Measure struct {
	Date  time.Time `json:"date"`
	Count int64     `json:"count"`
}

type Stargazer

type Stargazer struct {
	Name string `json:"by"`
}

type Stats

type Stats struct {
	Evolution  []Measure   `json:"evolution,omitempty"`
	PerDays    []Measure   `json:"per_days,omitempty"`
	Last10     []Stargazer `json:"last_10,omitempty"`
	CountStars int64       `json:"count_stars,omitempty"`
}

func (*Stats) Scan

func (s *Stats) Scan(src interface{}) error

func (Stats) Value

func (s Stats) Value() (driver.Value, error)

type Status

type Status string
const (
	StatusRequested Status = "requested"
	StatusGenerated Status = "generated"
)

Jump to

Keyboard shortcuts

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