models

package
v0.0.0-...-e197d81 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSite

func CreateSite(url string, db *sqlx.DB) error

CreateSite - store a new site instance in the DB

func GetSchemas

func GetSchemas(driver string) string

GetSchemas - return all the SQL commands needed to migrate a database

Types

type Website

type Website struct {
	ID  int    `db:"id"`
	URL string `db:"url"`
}

Website a representation of a site in the database

func (*Website) FindByURL

func (w *Website) FindByURL(url string, db *sqlx.DB) error

FindByURL - find a website in the database by it's URL

func (Website) GetSchema

func (w Website) GetSchema(driver string) string

GetSchema - return the SQL statement that describes this model's shape TODO: return different strings for different SQL drivers (sqlite3/mysql)

Jump to

Keyboard shortcuts

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