model

package
v0.0.0-...-4ffe60d Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScraperHN    = "hn"
	TypeHNShowHN = "show_hn"
	TypeHNAskHN  = "ask_hn"
	TypeHNStory  = "story"
	TypeHNJob    = "job"
	TypeUnknown  = "unknown"
)

Variables

This section is empty.

Functions

func InitDB

func InitDB(conf config.Config) (*sql.DB, error)

Types

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Story

type Story struct {
	ID          int64
	RefID       string
	Url         string
	By          string
	PublishedAt time.Time
	UpdatedAt   time.Time
	CreatedAt   time.Time
	LastSeenFp  time.Time
	Title       string
	Type        string
	Score       int32
	NumComments int32
	Scraper     string
	Deleted     bool
}

func Deserialize

func Deserialize(b []byte) (Story, error)

func (*Story) CommentsURL

func (s *Story) CommentsURL() string

func (*Story) Domain

func (s *Story) Domain() string

func (*Story) LinkURL

func (s *Story) LinkURL() string

func (*Story) SearchURL

func (s *Story) SearchURL() string

func (*Story) Serialize

func (s *Story) Serialize() ([]byte, error)

func (*Story) TimeAgo

func (s *Story) TimeAgo() string

func (*Story) TimeOnFP

func (s *Story) TimeOnFP() string

type StoryHistory

type StoryHistory struct {
	ID        int64
	StoryID   int64
	Field     string
	OldVal    string
	NewVal    string
	CreatedAt time.Time
}

type URLTransformer

type URLTransformer interface {
	Matches(u *url.URL) bool
	Transform(u *url.URL) *url.URL
}

func NewFarsideTransformer

func NewFarsideTransformer(host, service string) URLTransformer

Jump to

Keyboard shortcuts

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