models

package
v0.0.0-...-d444aea Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: Apache-2.0 Imports: 4 Imported by: 1

README

github.com/go-harpist/harpist/pkg/models

Data structures and database.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InitializeFirstRun = runInit

Functions

func GetDB

func GetDB(cf *config.Config) *gorm.DB

func RolesInit

func RolesInit(cf config.Config, db *gorm.DB)

Types

type AuthProfile

type AuthProfile struct {
	gorm.Model
	Roles    []*Role `gorm:"many2many:user_roles;"`
	Username string
	// contains filtered or unexported fields
}

func (AuthProfile) Authenticate

func (ap AuthProfile) Authenticate(username string, password string) (bool, error)

type Character

type Character struct {
	gorm.Model
	Name      string
	OwnerID   int
	OwnerType string
}

type Game

type Game struct {
	gorm.Model
	Name           string
	Slug           string
	OwnerID        int
	OwnerType      string
	GameCharacters []*Character
}

type GameProfile

type GameProfile struct {
	gorm.Model
	Games      []*Game
	Characters []*Character `gorm:"polymorphic:Owner;"`
}

type Role

type Role struct {
	gorm.Model
	Name        string `gorm:"unique;not null"`
	Permissions string
}

type User

type User struct {
	gorm.Model
	Name          string
	GameProfile   GameProfile
	GameProfileID int
	AuthProfile   AuthProfile
	AuthProfileID int
}

Jump to

Keyboard shortcuts

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