storage

package
v0.0.0-...-59b36f0 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDB

func GetDB() *gorm.DB

GetDB returns the singleton db instance

func Init

func Init(driver, addr string)

Init initializes the DB and runs migrations.

Types

type Challenge

type Challenge struct {
	gorm.Model
	Start  string
	Target string
}

func ChallengeByID

func ChallengeByID(id uint) (*Challenge, error)

ChallengeByID gets a challenge by id.

func (Challenge) Answer

func (c Challenge) Answer(ctx context.Context, cmd, user string) (*Solution, error)

type Solution

type Solution struct {
	gorm.Model
	Command   string
	Score     int `gorm:"default:0"`
	User      string
	Challenge Challenge
}

Jump to

Keyboard shortcuts

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