master

package
v0.0.0-...-d72fd11 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package master contains the sqlite database schema

Index

Constants

This section is empty.

Variables

View Source
var MasterSchema string

MasterSchema is the schema for the main database

Functions

This section is empty.

Types

type DeleteHTMLByIDParams

type DeleteHTMLByIDParams struct {
	ID int64 `db:"id" json:"id"`
}

type DeleteSelectorByIDParams

type DeleteSelectorByIDParams struct {
	ID int64 `db:"id" json:"id"`
}

type DeleteURLParams

type DeleteURLParams struct {
	ID int64 `db:"id" json:"id"`
}

type GetSelectorByIDParams

type GetSelectorByIDParams struct {
	ID int64 `db:"id" json:"id"`
}

type GetSelectorByValueParams

type GetSelectorByValueParams struct {
	Value string `db:"value" json:"value"`
}

type GetSelectorsByContextParams

type GetSelectorsByContextParams struct {
	Context string `db:"context" json:"context"`
}

type GetSelectorsByURLParams

type GetSelectorsByURLParams struct {
	Value string `db:"value" json:"value"`
}

type GetURLByValueParams

type GetURLByValueParams struct {
	Value string `db:"value" json:"value"`
}

type Html

type Html struct {
	ID        int64      `db:"id" json:"id"`
	Value     string     `db:"value" json:"value"`
	UpdatedAt *time.Time `db:"updated_at" json:"updated_at"`
	CreatedAt *time.Time `db:"created_at" json:"created_at"`
}

type InsertHTMLParams

type InsertHTMLParams struct {
	Value string `db:"value" json:"value"`
}

type InsertSelectorParams

type InsertSelectorParams struct {
	Value   string `db:"value" json:"value"`
	UrlID   int64  `db:"url_id" json:"url_id"`
	Context string `db:"context" json:"context"`
}

type InsertURLParams

type InsertURLParams struct {
	Value  string `db:"value" json:"value"`
	HtmlID int64  `db:"html_id" json:"html_id"`
}

type ListAllRow

type ListAllRow struct {
	ID       int64  `db:"id" json:"id"`
	Value    string `db:"value" json:"value"`
	Html     string `db:"html" json:"html"`
	Selector string `db:"selector" json:"selector"`
}

type Queries

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

Queries is the object to use to interact with the database.

func New

func New(db generic.DBTX) *Queries

New creates a new queries type

func (*Queries) DeleteHTMLByID

func (q *Queries) DeleteHTMLByID(ctx context.Context, arg DeleteHTMLByIDParams) error

DeleteHTMLByID

DELETE FROM
    htmls
WHERE
    id = ?

func (*Queries) DeleteSelectorByID

func (q *Queries) DeleteSelectorByID(ctx context.Context, arg DeleteSelectorByIDParams) error

DeleteSelectorByID

DELETE FROM
	selectors
WHERE
	id = ?

func (*Queries) DeleteURL

func (q *Queries) DeleteURL(ctx context.Context, arg DeleteURLParams) error

DeleteURL

DELETE FROM
    urls
WHERE
    id = ?

func (*Queries) GetSelectorByID

func (q *Queries) GetSelectorByID(ctx context.Context, arg GetSelectorByIDParams) (*Selector, error)

GetSelectorByID

SELECT
	id, value, url_id, context
FROM
	selectors
WHERE
	id = ?

func (*Queries) GetSelectorByValue

func (q *Queries) GetSelectorByValue(ctx context.Context, arg GetSelectorByValueParams) (*Selector, error)

GetSelectorByValue

SELECT
	id, value, url_id, context
FROM
	selectors
WHERE
	value = ?

func (*Queries) GetSelectorsByContext

func (q *Queries) GetSelectorsByContext(ctx context.Context, arg GetSelectorsByContextParams) ([]*Selector, error)

GetSelectorsByContext

SELECT
	id, value, url_id, context
FROM
	selectors
WHERE
	context = ?

func (*Queries) GetSelectorsByURL

func (q *Queries) GetSelectorsByURL(ctx context.Context, arg GetSelectorsByURLParams) ([]*Selector, error)

GetSelectorsByURL

SELECT
	selectors.id, selectors.value, selectors.url_id, selectors.context
FROM
	selectors
	JOIN urls ON urls.id = selectors.url_id
WHERE
	urls.value = ?

func (*Queries) GetURLByValue

func (q *Queries) GetURLByValue(ctx context.Context, arg GetURLByValueParams) (*Url, error)

GetURLByValue

SELECT
    id, value, html_id
FROM
    urls
WHERE
    value = ?

func (*Queries) InsertHTML

func (q *Queries) InsertHTML(ctx context.Context, arg InsertHTMLParams) (*Html, error)

InsertHTML

INSERT INTO
    htmls (value)
VALUES
    (?) RETURNING id, value, updated_at, created_at

func (*Queries) InsertSelector

func (q *Queries) InsertSelector(ctx context.Context, arg InsertSelectorParams) (*Selector, error)

**************************************************************************** ****************************************************************************

/*
 ** selectors.sql
 ** Description: This file contains the SQLite queries for the selectors table
 ** Dialect: sqlite3
 */
INSERT INTO
	selectors (value, url_id, context)
VALUES
	(?, ?, ?) RETURNING id, value, url_id, context

func (*Queries) InsertURL

func (q *Queries) InsertURL(ctx context.Context, arg InsertURLParams) (*Url, error)

InsertURL

INSERT INTO
    urls (value, html_id)
VALUES
    (?, ?) RETURNING id, value, html_id

func (*Queries) ListAll

func (q *Queries) ListAll(ctx context.Context) ([]*ListAllRow, error)

ListAll

SELECT
    urls.id,
    urls.value,
    htmls.value as html,
    selectors.value as selector
FROM
    urls
    JOIN htmls ON urls.html_id = htmls.id
    JOIN selectors ON urls.id = selectors.url_id

func (*Queries) ListHTMLs

func (q *Queries) ListHTMLs(ctx context.Context) ([]*Html, error)

****************************************************************************

/*
 ** File: htmls.sql
 ** Description: This file contains the SQLite queries for the htmls table
 ** Dialect: sqlite3
 */
SELECT
    id, value, updated_at, created_at
from
    htmls

func (*Queries) ListURLs

func (q *Queries) ListURLs(ctx context.Context) ([]*Url, error)

**************************************************************************** ****************************************************************************

/*
 ** File: urls.sql
 ** Description: This file contains the SQLite queries for the urls table
 ** Dialect: sqlite3
 */
SELECT
    id, value, html_id
from
    urls

func (*Queries) UpdateHTMLByID

func (q *Queries) UpdateHTMLByID(ctx context.Context, arg UpdateHTMLByIDParams) (*Html, error)

UpdateHTMLByID

UPDATE
    htmls
SET
    value = ?
WHERE
    id = ? RETURNING id, value, updated_at, created_at

func (*Queries) UpdateSelectorByID

func (q *Queries) UpdateSelectorByID(ctx context.Context, arg UpdateSelectorByIDParams) error

UpdateSelectorByID

UPDATE
	selectors
SET
	value = ?,
	url_id = ?,
	context = ?
WHERE
	id = ?

func (*Queries) UpdateURL

func (q *Queries) UpdateURL(ctx context.Context, arg UpdateURLParams) error

UpdateURL

UPDATE
    urls
SET
    value = ?,
    html_id = ?
WHERE
    id = ?

func (*Queries) UpsertURL

func (q *Queries) UpsertURL(ctx context.Context, arg UpsertURLParams) (*Url, error)

UpsertURL

INSERT INTO
    urls (value, html_id)
VALUES
    (?, ?)
ON CONFLICT (value)
DO UPDATE
    SET
        html_id = excluded.html_id RETURNING id, value, html_id

func (*Queries) WithTx

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

WithTx creates a new queries type with a transaction.

type Selector

type Selector struct {
	ID      int64  `db:"id" json:"id"`
	Value   string `db:"value" json:"value"`
	UrlID   int64  `db:"url_id" json:"url_id"`
	Context string `db:"context" json:"context"`
}

type UpdateHTMLByIDParams

type UpdateHTMLByIDParams struct {
	Value string `db:"value" json:"value"`
	ID    int64  `db:"id" json:"id"`
}

type UpdateSelectorByIDParams

type UpdateSelectorByIDParams struct {
	Value   string `db:"value" json:"value"`
	UrlID   int64  `db:"url_id" json:"url_id"`
	Context string `db:"context" json:"context"`
	ID      int64  `db:"id" json:"id"`
}

type UpdateURLParams

type UpdateURLParams struct {
	Value  string `db:"value" json:"value"`
	HtmlID int64  `db:"html_id" json:"html_id"`
	ID     int64  `db:"id" json:"id"`
}

type UpsertURLParams

type UpsertURLParams struct {
	Value  string `db:"value" json:"value"`
	HtmlID int64  `db:"html_id" json:"html_id"`
}

type Url

type Url struct {
	ID     int64  `db:"id" json:"id"`
	Value  string `db:"value" json:"value"`
	HtmlID int64  `db:"html_id" json:"html_id"`
}

Jump to

Keyboard shortcuts

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