db

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2023 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoMigrations added in v0.3.0

func DoMigrations(db *bun.DB) error

func New

func New(filename string) (*bun.DB, error)

Types

type Feed

type Feed struct {
	bun.BaseModel `bun:"table:feeds"`

	ID     string `bun:"id,pk"`
	URL    string `bun:"url,notnull"`
	Name   string `bun:"name,notnull"`
	UserID string `bun:"user_id,notnull"`

	LastEtag      string `bun:"last_etag,nullzero"`
	LastModified  string `bun:"last_modified,nullzero"`
	CachedContent string `bun:"cached_content,nullzero"`

	User *User `bun:",rel:belongs-to,join:user_id=id"`
}

func (*Feed) CacheWithEtag added in v0.3.4

func (f *Feed) CacheWithEtag(etag, content string)

func (*Feed) CacheWithLastModified added in v0.3.4

func (f *Feed) CacheWithLastModified(lastModified, content string)

type FeedSlice

type FeedSlice []*Feed

func (FeedSlice) Len

func (f FeedSlice) Len() int

func (FeedSlice) Less

func (f FeedSlice) Less(i, j int) bool

func (FeedSlice) Swap

func (f FeedSlice) Swap(i, j int)

type SendDay

type SendDay uint32
const (
	SendDayNever SendDay = iota
	SendDaily
	SendOnMonday
	SendOnTuesday
	SendOnWednesday
	SendOnThursday
	SendOnFriday
	SendOnSaturday
	SendOnSunday
	LastSendDay
)

func SendDayFromWeekday

func SendDayFromWeekday(w time.Weekday) SendDay

func (SendDay) MarshalText

func (s SendDay) MarshalText() ([]byte, error)

func (SendDay) String

func (s SendDay) String() string

func (*SendDay) UnmarshalText

func (s *SendDay) UnmarshalText(x []byte) error

type User

type User struct {
	bun.BaseModel `bun:"table:users"`

	ID       string `bun:"id,pk"`
	Email    string `bun:"email,notnull,unique"`
	Password []byte `bun:"password"`
	Salt     []byte `bun:"salt"`

	Active       bool    `bun:"active,notnull"`
	ScheduleDay  SendDay `bun:"schedule_day"`
	ScheduleHour int     `bun:"schedule_hour"`
}

Jump to

Keyboard shortcuts

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