internal

package
v0.0.0-...-84f6849 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupDatabase

func SetupDatabase(config DatabaseConfig) (*gorm.DB, error)

func SetupDatabaseWithDSN

func SetupDatabaseWithDSN(connString string) (*gorm.DB, error)

Types

type AuthService

type AuthService interface {
	CompleteUserAuth(w http.ResponseWriter, r *http.Request) (goth.User, error)
}

type Book

type Book struct {
	ISBN  string `gorm:"primaryKey"`
	URL   string `json:"url"`
	Title string `json:"title"`
}

type DatabaseConfig

type DatabaseConfig struct {
	Host        string `env:"POSTGRES_HOST" validate:"hostname"`
	DbUser      string `env:"POSTGRES_USER"`
	Password    string `env:"POSTGRES_PASSWORD"`
	Dbname      string `env:"POSTGRES_DBNAME"`
	Port        int    `env:"POSTGRES_PORT"`
	Sslmode     string `env:"POSTGRES_SSLMODE"`
	Timezone    string `env:"TIMEZONE"`
	DatabaseUrl string `env:"DATABASE_URL"`
}

func ReadDatabaseConfig

func ReadDatabaseConfig() (DatabaseConfig, error)

type GothicAuthService

type GothicAuthService struct {
}

func (*GothicAuthService) CompleteUserAuth

func (svc *GothicAuthService) CompleteUserAuth(w http.ResponseWriter, r *http.Request) (goth.User, error)

type JwtService

type JwtService interface {
	CreateToken(issuer string, id int) (string, error)
}

type JwtServiceImpl

type JwtServiceImpl struct {
}

func (JwtServiceImpl) CreateToken

func (srv JwtServiceImpl) CreateToken(issuer string, id int) (string, error)
type Link struct {
	SenderId   uint `gorm:"primaryKey"` //TODO: the concept of sender/receiver id is crap
	ReceiverId uint `gorm:"primaryKey"`
	CreatedAt  time.Time
	AcceptedAt time.Time
	DeletedAt  time.Time
}

type User

type User struct {
	gorm.Model
	Name  string
	Email string
	Books []Book `gorm:"many2many:user_books"`
}

type UserBooks

type UserBooks struct {
	UserId    int    `gorm:"primaryKey"`
	BookISBN  string `gorm:"primaryKey"`
	CreatedAt time.Time
	DeletedAt gorm.DeletedAt
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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