database

package
v0.0.0-...-5ccde39 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// This is the format for a SQL Datetime Literal.
	SQLDateTimeFormat = "2006-01-02 15:04:05"
)

Variables

This section is empty.

Functions

func Initialize

func Initialize(connection string) (*sqlx.DB, error)

func InitializeForTest

func InitializeForTest() (*sqlx.DB, error)

InitializeForTest creates an in-memory SQL database for tests only.

Types

type TableCheck

type TableCheck struct {
	DoesExist int `db:"does_exist"`
}

type Visit

type Visit struct {
	IP        string `db:"ip"`
	Host      string `db:"host"`
	Path      string `db:"path"`
	UserAgent string `db:"user_agent"`
	CreatedAt string `db:"created_at"`
}

func Get

func Get(db *sqlx.DB, id int) (Visit, error)

func (*Visit) Save

func (v *Visit) Save(db *sqlx.DB) error

func (*Visit) String

func (v *Visit) String() string

Jump to

Keyboard shortcuts

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