database

package
v0.0.0-...-fc272d6 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DatabaseAlreadyExistsErrorCode = "42P04"
View Source
const UniqueViolationErrorCode = "23505"

Variables

This section is empty.

Functions

func CreateDbIfNotExists

func CreateDbIfNotExists() (err error)

func CreateScraped

func CreateScraped(db *gorm.DB, scraped *models.RestaurantSnapshot) error

func CreateUser

func CreateUser(db *gorm.DB, username string, passwordHash string) error

func GetUser

func GetUser(db *gorm.DB, username string) (models.User, error)

func IsRecordNotFound

func IsRecordNotFound(err error) bool

func IsUniqueViolation

func IsUniqueViolation(err error) bool

func SelectSnapshotById

func SelectSnapshotById(db *gorm.DB, id uint) (models.RestaurantSnapshot, error)

func SelectSnapshotWith

func SelectSnapshotWith(db *gorm.DB, id uint) (models.RestaurantSnapshot, error)

func SelectTodaysSnapshots

func SelectTodaysSnapshots(db *gorm.DB) ([]models.RestaurantSnapshot, error)

func Setup

func Setup() (db *gorm.DB, err error)

func UpdateVote

func UpdateVote(db *gorm.DB, restaurantId uint, userId uint, shouldCast bool) error

func UpdateVotedOn

func UpdateVotedOn(db *gorm.DB, formResult *data.NewPollFormDataToServer) error

Types

type DayAlreadyPopulatedError

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

func (*DayAlreadyPopulatedError) Error

func (e *DayAlreadyPopulatedError) Error() string

Jump to

Keyboard shortcuts

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