util

package
v0.0.0-...-1ab822e Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ERR_NOT_AUTHORIZED = "ERR_NOT_AUTHORIZED"
)

Variables

This section is empty.

Functions

func CreateDatabase

func CreateDatabase() (*gorm.DB, error)

func ExtractAuth

func ExtractAuth(c echo.Context) (string, error)

func GenerateToken

func GenerateToken(n int) string

func WithUser

func WithUser(f func(echo.Context, *User) error) func(echo.Context) error

Types

type HttpError

type HttpError struct {
	Code    int    `json:"code,omitempty"`
	Reason  string `json:"reason"`
	Details string `json:"details"`
}

func (HttpError) Error

func (he HttpError) Error() string

type Photo

type Photo struct {
	gorm.Model
	Name   string `json:"name"`
	UserID uint   `json:"user_id"`
	CID    string `json:"cid" gorm:"column:cid"`
}

type User

type User struct {
	gorm.Model
	Handle string  `json:"handle" gorm:"unique"`
	ApiKey string  `json:"apikey" gorm:"column:apikey"`
	Photos []Photo `json:photos`
}

Jump to

Keyboard shortcuts

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