Back to godoc.org

Package db

v0.0.0-...-ffd16d0
Latest Go to latest

The latest major version is .

Published: Jul 8, 2020 | License: LGPL-3.0 | Module: github.com/urandom/readeef

Index

func Register

func Register(driver string, helper Helper)

type ArticleStmts

type ArticleStmts struct {
	Create string
	Update string

	GetUserlessTemplate      string
	GetTemplate              string
	CountTemplate            string
	CountUserFeedsJoin       string
	StateReadColumn          string
	StateUnreadJoin          string
	StateFavoriteJoin        string
	GetIDsTemplate           string
	DeleteStaleUnreadRecords string
	GetScoreJoin             string
	GetUntaggedJoin          string

	ReadStateInsertTemplate     string
	ReadStateDeleteTemplate     string
	FavoriteStateInsertTemplate string
	FavoriteStateDeleteTemplate string
}

type DB

type DB struct {
	*sqlx.DB
	// contains filtered or unexported fields
}

func New

func New(log log.Log) *DB

func (*DB) CreateWithID

func (db *DB) CreateWithID(tx *sqlx.Tx, sql string, arg interface{}) (id int64, err error)

func (*DB) Open

func (db *DB) Open(driver, connect string) (err error)

func (DB) SQL

func (db DB) SQL() SqlStmts

Can't recover from missing driver or statement, panic

func (*DB) WhereMultipleORs

func (db *DB) WhereMultipleORs(column, prefix string, length int, equal bool) string

func (*DB) WithNamedStmt

func (db *DB) WithNamedStmt(query string, tx *sqlx.Tx, cb func(*sqlx.NamedStmt) error) error

func (*DB) WithStmt

func (db *DB) WithStmt(query string, tx *sqlx.Tx, cb func(*sqlx.Stmt) error) error

func (*DB) WithTx

func (db *DB) WithTx(cb func(*sqlx.Tx) error) error

type ExtractStmts

type ExtractStmts struct {
	Get    string
	Create string
	Update string
}

type FeedStmts

type FeedStmts struct {
	Get          string
	GetByLink    string
	GetForUser   string
	All          string
	AllForUser   string
	AllForTag    string
	Unsubscribed string

	IDs    string
	Create string
	Update string
	Delete string

	GetUsers       string
	Attach         string
	Detach         string
	CreateUserTag  string
	DeleteUserTags string
}

type Helper

type Helper interface {
	SQL() SqlStmts
	InitSQL() []string

	CreateWithID(tx *sqlx.Tx, sql string, arg interface{}) (int64, error)
	Upgrade(db *DB, old, new int) error

	WhereMultipleORs(string, string, int, bool) string
	RetryableErr(err error) bool
}

type ScoresStmts

type ScoresStmts struct {
	Get    string
	Create string
	Update string
}

type SqlStmts

type SqlStmts struct {
	Article      ArticleStmts
	Extract      ExtractStmts
	Feed         FeedStmts
	Scores       ScoresStmts
	Subscription SubscriptionStmts
	Tag          TagStmts
	Thumbnail    ThumbnailStmts
	User         UserStmts
}

type SubscriptionStmts

type SubscriptionStmts struct {
	GetForFeed string
	All        string

	Create string
	Update string
}

type TagStmts

type TagStmts struct {
	Get            string
	GetByValue     string
	AllForUser     string
	AllForFeed     string
	Create         string
	GetUserFeedIDs string
	DeleteStale    string
}

type ThumbnailStmts

type ThumbnailStmts struct {
	Get    string
	Create string
	Update string
}

type UserStmts

type UserStmts struct {
	Get         string
	GetByMD5API string
	All         string

	Create string
	Update string
	Delete string
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier