server

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2022 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UnitTest = iota + 1
	IntegrationTest

	SmokeTest
	LoadTest
	PerformanceTest
	AcceptenceTest
)

Variables

View Source
var ErrTestNotFound = fmt.Errorf("Test not found")

Functions

func AddTest

func AddTest(p *Test) error

func DeleteTest

func DeleteTest(id primitive.ObjectID) error

func UpdateTest

func UpdateTest(id primitive.ObjectID, p *Test) error

Types

type Test

type Test struct {
	ID          primitive.ObjectID `json:"id" bson:"_id"`
	Name        string             `json:"name" bson:"name"`
	Description string             `json:"description" bson:"description" validate:"required"`
	TestType    TestType           `json:"type" bson:"type" validate:"gte=1,lte10"` //validate:"validateTestType"
	RunAt       time.Time          `json:"run" bson:"run"`
}

func GetTestById

func GetTestById(id primitive.ObjectID) (*Test, error)

func (*Test) FromJSON

func (p *Test) FromJSON(r io.Reader) error

func (*Test) ToJSON

func (p *Test) ToJSON(w io.Writer) error

func (*Test) Validate

func (p *Test) Validate() error

type TestType

type TestType int

type Tests

type Tests []*Test

Products is a collection of Product

func GetTests

func GetTests() Tests

GetProducts returns a list of products

func (*Tests) ToJSON

func (p *Tests) ToJSON(w io.Writer) error

ToJSON serializes the contents of the collection to JSON NewEncoder provides better performance than json.Unmarshal as it does not have to buffer the output into an in memory slice of bytes this reduces allocations and the overheads of the service

https://golang.org/pkg/encoding/json/#NewEncoder

Jump to

Keyboard shortcuts

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