holes

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: MIT Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHole

func GetHole(w http.ResponseWriter, r *http.Request)

GetHole gets a hole using an id

func GetTest

func GetTest(w http.ResponseWriter, r *http.Request)

GetTest gets a test using a hole and test id

func HoleTitle

func HoleTitle(str string) string

HoleTitle sets the hole title to an id using string lower

func ListHoles

func ListHoles(w http.ResponseWriter, r *http.Request)

ListHoles lists 100 active holes

func ListTests

func ListTests(w http.ResponseWriter, r *http.Request)

ListTests gets all tests for a specific hole

Types

type Hole

type Hole struct {
	ID         string `json:"ID"`
	Name       string `json:"Name"`
	Difficulty string `json:"Difficulty"`
	Question   string `json:"Question"`

	CreatedAt     time.Time `json:"CreatedAt"`
	CreatedBy     string    `json:"CreatedBy"`
	LastUpdatedAt time.Time `json:"LastUpdatedAt"`
	Active        bool      `json:"Active"`
}

func (Hole) Collection

func (h Hole) Collection() *firestore.CollectionRef

DB Interface stuff

func (Hole) Data

func (h Hole) Data() interface{}

func (Hole) DocID

func (h Hole) DocID() string

type Holes

type Holes []Hole

func (Holes) Len

func (hs Holes) Len() int

Sort interface stuff

func (Holes) Less

func (hs Holes) Less(i, j int) bool

func (Holes) Swap

func (hs Holes) Swap(i, j int)

type ShortTest

type ShortTest struct {
	ID          string `json:"ID"`
	Name        string `json:"Name"`                  // Test name on the frontend
	Hidden      bool   `json:"Hidden"`                // When hidden is false, output will be shown on frontend
	Input       string `json:"Input,omitempty"`       // Returns test input when test is NOT hidden
	Description string `json:"Description,omitempty"` // Optional description field
	Active      bool   `json:"Active"`
}

ShortTest is the frontend object for a Test structure

type ShortTests

type ShortTests []ShortTest

type Test

type Test struct {
	ID          string `json:"ID"`
	Name        string `json:"Name"`        // Test name on the frontend
	Hidden      bool   `json:"Hidden"`      // When hidden is false, output will be shown on frontend
	Description string `json:"Description"` // Optional description field
	Active      bool   `json:"Active"`

	Input       string `json:"Input"`
	OutputRegex string `json:"OutputRegex"`

	CreatedAt time.Time `json:"CreatedAt"`
}

Test extends ShortTest and has hidden information solely for the database

func (Test) Check

func (test Test) Check(output string) (bool, error)

Check is a function to see if the output given is correct in the scope of the test

func (Test) ShortTest

func (t Test) ShortTest() ShortTest

ShortTest returns what a user should see for a test case. If a test is not hidden, then the input is returned as well

type Tests

type Tests []Test

func GetTests

func GetTests(hole string) (Tests, error)

func (Tests) ShortTests

func (ts Tests) ShortTests() ShortTests

Jump to

Keyboard shortcuts

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