persistence

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountUrlsWhere

func CountUrlsWhere(ctx context.Context, db *sql.DB, where string, args ...interface{}) (int, error)

Count the number of urls that match the given where clause. URL meta is available in the where clause as well.

func GetLatestTime

func GetLatestTime(ctx context.Context, db *sql.DB, extractor types.Extractor) (*time.Time, error)

func InitDb

func InitDb(ctx context.Context, c *config.AppConfig) (*sql.DB, error)

Initialize the database. Create tables and indexes

func InsertUrl

func InsertUrl(ctx context.Context, db *sql.DB, row *types.UrlRow) error

func InsertUrlMeta

func InsertUrlMeta(ctx context.Context, db *sql.DB, row *types.UrlMetaRow) error

func InsertVisit

func InsertVisit(ctx context.Context, db *sql.DB, row *types.VisitRow) error

func OpenConnection

func OpenConnection(ctx context.Context, c *config.AppConfig) (*sql.DB, error)

Open a connection to the database. Calling code should close the connection when done. @note It is assumed that the database is already initialized. Thus this may be less useful than `InitDB`

func UrlsById

func UrlsById(ctx context.Context, db *sql.DB, ids ...string) ([]types.UrlDbEntity, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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