zh_db

package
v0.0.0-...-85fa51d Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DbInit

func DbInit() dbSingleTon

func SqliteExist

func SqliteExist()

If dbPath does not exist mkdir and touch sqlite.db

Types

type CreateArticleParams

type CreateArticleParams struct {
	Link        string
	Title       string
	Article     string
	ArticleGen  string
	TimeCreated string
}

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) CreateArticle

func (q *Queries) CreateArticle(ctx context.Context, arg CreateArticleParams) error

func (*Queries) GetAll

func (q *Queries) GetAll(ctx context.Context) ([]Zh, error)

func (*Queries) GetById

func (q *Queries) GetById(ctx context.Context, id int64) (Zh, error)

func (*Queries) WithTx

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

type Zh

type Zh struct {
	ID          int64
	Link        string
	Title       string
	Article     string
	ArticleGen  string
	TimeCreated string
}

Jump to

Keyboard shortcuts

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