db

package
v0.0.0-...-95c851e Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2024 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(driver string, helper Helper)

Types

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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