sqlite

package
v0.0.0-...-7ea3493 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrToDomainErr

func ErrToDomainErr(err error) error

func ModelToDomain

func ModelToDomain(f Fact) service.Fact

func Schema

func Schema() string

Types

type CreateFactParams

type CreateFactParams struct {
	Content string
	Source  sql.NullString
}

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 Fact

type Fact struct {
	ID        int64
	CreatedAt sql.NullTime
	UpdatedAt sql.NullTime
	DeletedAt sql.NullTime
	Content   string
	Source    sql.NullString
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) CreateFact

func (q *Queries) CreateFact(ctx context.Context, arg CreateFactParams) (Fact, error)

func (*Queries) DeleteFact

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

func (*Queries) GetFact

func (q *Queries) GetFact(ctx context.Context, id int64) (Fact, error)

func (*Queries) GetFacts

func (q *Queries) GetFacts(ctx context.Context) ([]Fact, error)

func (*Queries) GetRandomFact

func (q *Queries) GetRandomFact(ctx context.Context) (Fact, error)

func (*Queries) SoftDeleteFact

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

func (*Queries) WithTx

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

type Repo

type Repo struct {
	// contains filtered or unexported fields
}

func NewRepo

func NewRepo(db *sql.DB) *Repo

func (*Repo) CreateFact

func (r *Repo) CreateFact(ctx context.Context, content, source string) (service.Fact, error)

func (*Repo) DeleteFact

func (r *Repo) DeleteFact(ctx context.Context, id int64) error

func (*Repo) Fact

func (r *Repo) Fact(ctx context.Context, id int64) (service.Fact, error)

func (*Repo) Facts

func (r *Repo) Facts(ctx context.Context) ([]service.Fact, error)

func (*Repo) RandomFact

func (r *Repo) RandomFact(ctx context.Context) (service.Fact, error)

Jump to

Keyboard shortcuts

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