repository

package
v0.0.0-...-1506d98 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("not found")
)

Functions

func NewCategoryRepository

func NewCategoryRepository(db *sqlx.DB) *categoryRepository

func NewEntryRepository

func NewEntryRepository(db *sqlx.DB) *entryRepository

func NewFeedRepository

func NewFeedRepository(db *sqlx.DB) *feedRepository

func NewSettingsRepository

func NewSettingsRepository(db *sqlx.DB) *settingsRepository

func NewTransactionRepository

func NewTransactionRepository(db *sqlx.DB) *transactionRepository

Types

type Category

type Category struct {
	ID        int64    `db:"id" json:"id"`
	Title     string   `db:"title" json:"title"`
	Order     int      `db:"order" json:"-"`
	CreatedAt Time     `db:"created_at" json:"-"`
	UpdatedAt NullTime `db:"updated_at" json:"-"`
	DeletedAt NullTime `db:"deleted_at" json:"-"`

	Feeds []Feed `db:"-" json:"feeds"`
}

type Entry

type Entry struct {
	ID          int64      `db:"id" json:"id"`
	Title       string     `db:"title" json:"title"`
	Author      NullString `db:"author" json:"author"`
	Summary     NullString `db:"summary" json:"summary"`
	Link        string     `db:"link" json:"link"`
	PublishedAt Time       `db:"published_at" json:"published_at"`
	FeedID      int64      `db:"feed_id" json:"feed_id"`
	ReadAt      NullTime   `db:"read_at" json:"read_at"`
	CreatedAt   Time       `db:"created_at" json:"-"`
	UpdatedAt   NullTime   `db:"updated_at" json:"-"`
	DeletedAt   NullTime   `db:"deleted_at" json:"-"`

	Feed     Feed `db:"-" json:"feed"`
	NewEntry bool `db:"-" json:"new_entry"`
}

type Feed

type Feed struct {
	ID             int64      `db:"id" json:"id"`
	FeedTitle      string     `db:"feed_title" json:"feed_title"`
	FeedUrl        string     `db:"feed_url" json:"feed_url"`
	FeedImage      NullString `db:"feed_image" json:"feed_image"`
	FeedSubtitle   NullString `db:"feed_subtitle" json:"feed_subtitle"`
	SiteUrl        NullString `db:"site_url" json:"site_url"`
	SiteFaviconUrl NullString `db:"site_favicon_url" json:"site_favicon_url"`
	SiteFavicon    NullString `db:"site_favicon" json:"site_favicon"`
	CategoryID     int64      `db:"category_id" json:"category_id"`
	LastReadAt     Time       `db:"last_read_at" json:"-"`
	CreatedAt      Time       `db:"created_at" json:"-"`
	UpdatedAt      NullTime   `db:"updated_at" json:"-"`
	DeletedAt      NullTime   `db:"deleted_at" json:"-"`

	UnRead     int64 `db:"un_read" json:"un_read"`
	NewEntries int64 `db:"new_entries" json:"new_entries"`
}

type NullString

type NullString struct {
	sql.NullString
}

func NewNullString

func NewNullString(value string) NullString

func (NullString) MarshalJSON

func (ni NullString) MarshalJSON() ([]byte, error)

type NullTime

type NullTime struct {
	sql.NullTime
}

func NewNullTime

func NewNullTime(value time.Time) NullTime

func (NullTime) MarshalJSON

func (nt NullTime) MarshalJSON() ([]byte, error)

type SessionRepository

type SessionRepository struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewSessionRepository

func NewSessionRepository(age time.Duration) *SessionRepository

func (*SessionRepository) Delete

func (r *SessionRepository) Delete(sessionID string) error

func (*SessionRepository) Get

func (r *SessionRepository) Get(sessionID string) (map[string]interface{}, error)

func (*SessionRepository) Set

func (r *SessionRepository) Set(sessionID string, data map[string]interface{}) error

type Time

type Time struct {
	time.Time
}

Time struct wraps time.Time, so can be used with sql and custom marshaling.

func NewTime

func NewTime(value time.Time) Time

func (Time) After

func (t Time) After(u Time) bool

After reports whether the time instant t is after u.

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON marshal time in YYYY-MM-DD HH:MM format.

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan implements the Scanner interface.

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type User

type User struct {
	Name     string `db:"name" json:"name"`
	Password []byte `db:"password" json:"-"`
}

func (*User) SetPassword

func (u *User) SetPassword(pass string) error

func (User) Validate

func (u User) Validate(user, pass string) bool

Jump to

Keyboard shortcuts

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