db

package
v0.0.0-...-9bbc724 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const CreateURL = `` /* 131-byte string literal not displayed */
View Source
const DeleteURL = `-- name: DeleteURL :exec
UPDATE urls
SET DELETED_AT = NOW()
WHERE alias = $1
	AND deleted_at IS NULL
`
View Source
const GetURLFromAlias = `` /* 147-byte string literal not displayed */

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateURLParams

type CreateURLParams struct {
	Alias string `json:"alias"`
	Url   string `json:"url"`
}

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 Querier

type Querier interface {
	CreateURL(ctx context.Context, db DBTX, arg CreateURLParams) (Url, error)
	DeleteURL(ctx context.Context, db DBTX, alias string) error
	// SHORTLY
	GetURLFromAlias(ctx context.Context, db DBTX, alias string) (Url, error)
}

type Queries

type Queries struct {
}

func New

func New() *Queries

func (*Queries) CreateURL

func (q *Queries) CreateURL(ctx context.Context, db DBTX, arg CreateURLParams) (Url, error)

func (*Queries) DeleteURL

func (q *Queries) DeleteURL(ctx context.Context, db DBTX, alias string) error

func (*Queries) GetURLFromAlias

func (q *Queries) GetURLFromAlias(ctx context.Context, db DBTX, alias string) (Url, error)

SHORTLY

type Url

type Url struct {
	ID        int64        `json:"id"`
	Url       string       `json:"url"`
	Alias     string       `json:"alias"`
	CreatedAt time.Time    `json:"created_at"`
	UpdatedAt time.Time    `json:"updated_at"`
	DeletedAt sql.NullTime `json:"deleted_at"`
}

Jump to

Keyboard shortcuts

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