model

package
v0.0.0-...-b13ab0d Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddRunningPlan

func AddRunningPlan(collectionID, planID int64) error

func CreateCollection

func CreateCollection(name string, projectID int64) (int64, error)

func CreatePlan

func CreatePlan(name string, projectID int64) (int64, error)

func CreateProject

func CreateProject(name, owner string) (int64, error)

func DeleteRunningPlan

func DeleteRunningPlan(collectionID, planID int64) error

Types

type Account

type Account struct {
	ML    []string
	MLMap map[string]interface{}
	Name  string
}

func GetAccountBySession

func GetAccountBySession(r *http.Request) *Account

type Collection

type Collection struct {
	ID             int64            `json:"id"`
	Name           string           `json:"name"`
	ProjectID      int64            `json:"project_id"`
	ExecutionPlans []*ExecutionPlan `json:"execution_plans"`
	RunHistories   []*RunHistory    `json:"run_history"`
	CreatedTime    time.Time        `json:"created_time"`
	Data           []*ShibuyaFile   `json:"data"`
	CSVSplit       bool             `json:"csv_split"`
}

func GetCollection

func GetCollection(ID int64) (*Collection, error)

func (*Collection) AddExecutionPlan

func (c *Collection) AddExecutionPlan(ep *ExecutionPlan) error

func (*Collection) Delete

func (c *Collection) Delete() error

func (*Collection) DeleteAllFiles

func (c *Collection) DeleteAllFiles() error

func (*Collection) DeleteExecutionPlan

func (c *Collection) DeleteExecutionPlan(collectionID, planID int64) error

func (*Collection) DeleteExecutionPlans

func (c *Collection) DeleteExecutionPlans() error

func (*Collection) DeleteFile

func (c *Collection) DeleteFile(filename string) error

func (*Collection) DeleteRunHistory

func (c *Collection) DeleteRunHistory() error

func (*Collection) GetCurrentRun

func (c *Collection) GetCurrentRun() (int64, error)

func (*Collection) GetExecutionPlans

func (c *Collection) GetExecutionPlans() ([]*ExecutionPlan, error)

func (*Collection) GetLastRun

func (c *Collection) GetLastRun() (*RunHistory, error)

func (*Collection) GetRuns

func (c *Collection) GetRuns() ([]*RunHistory, error)

func (*Collection) HasRunningPlan

func (c *Collection) HasRunningPlan() (bool, error)

func (*Collection) MakeFileName

func (c *Collection) MakeFileName(filename string) string

func (*Collection) NewRun

func (c *Collection) NewRun(runID int64) error

func (*Collection) RunFinish

func (c *Collection) RunFinish(runID int64) error

func (*Collection) StartRun

func (c *Collection) StartRun() (int64, error)

func (*Collection) StopRun

func (c *Collection) StopRun() error

func (*Collection) Store

func (c *Collection) Store(ec *ExecutionCollection) error

func (*Collection) StoreFile

func (c *Collection) StoreFile(content io.ReadCloser, filename string) error

type DBError

type DBError struct {
	Err     error
	Message string
}

func (*DBError) Error

func (e *DBError) Error() string

type ExecutionCollection

type ExecutionCollection struct {
	Name         string           `yaml:"name"`
	ProjectID    int64            `yaml:"projectid"`
	CollectionID int64            `yaml:"collectionid"`
	Tests        []*ExecutionPlan `yaml:"tests"`
	CSVSplit     bool             `yaml:"csv_split"`
}

type ExecutionPlan

type ExecutionPlan struct {
	Name        string `yaml:"name" json:"name"`
	PlanID      int64  `yaml:"testid" json:"plan_id"`
	Concurrency int    `yaml:"concurrency" json:"concurrency"`
	Rampup      int    `yaml:"rampup" json:"rampup"`
	Engines     int    `yaml:"engines" json:"engines"`
	Duration    int    `yaml:"duration" json:"duration"`
	CSVSplit    bool   `yaml:"csv_split" json:"csv_split"` // go-sql-driver does not support tinyint mapped to bool directly: https://github.com/go-sql-driver/mysql/issues/440
}

func GetExecutionPlan

func GetExecutionPlan(collectionID, planID int64) (*ExecutionPlan, error)

type ExecutionWrapper

type ExecutionWrapper struct {
	Content *ExecutionCollection `yaml:"multi-test"`
}

type Plan

type Plan struct {
	ID          int64          `json:"id"`
	Name        string         `json:"name"`
	ProjectID   int64          `json:"project_id"`
	CreatedTime time.Time      `json:"created_time"`
	TestFile    *ShibuyaFile   `json:"test_file"`
	Data        []*ShibuyaFile `json:"data"`
}

func GetPlan

func GetPlan(ID int64) (*Plan, error)

func (*Plan) Delete

func (p *Plan) Delete() error

func (*Plan) DeleteAllFiles

func (p *Plan) DeleteAllFiles() error

func (*Plan) DeleteFile

func (p *Plan) DeleteFile(filename string) error

func (*Plan) GetPlanFiles

func (p *Plan) GetPlanFiles() (*ShibuyaFile, []*ShibuyaFile, error)

func (*Plan) IsBeingUsed

func (p *Plan) IsBeingUsed() (bool, error)

func (*Plan) MakeFileName

func (p *Plan) MakeFileName(filename string) string

func (*Plan) StoreFile

func (p *Plan) StoreFile(content io.ReadCloser, filename string) error

type Project

type Project struct {
	ID          int64         `json:"id"`
	Name        string        `json:"name"`
	Owner       string        `json:"owner"`
	CreatedTime time.Time     `json:"created_time"`
	Collections []*Collection `json:"collections"`
	Plans       []*Plan       `json:"plans"`
}

func GetProject

func GetProject(id int64) (*Project, error)

func GetProjectsByOwners

func GetProjectsByOwners(owners []string) ([]*Project, error)

func (*Project) Delete

func (p *Project) Delete() error

func (*Project) GetCollections

func (p *Project) GetCollections() ([]int64, error)

func (*Project) GetPlans

func (p *Project) GetPlans() ([]*Plan, error)

type RunHistory

type RunHistory struct {
	ID           int64     `json:"id"`
	CollectionID int64     `json:"collection_id"`
	StartedTime  time.Time `json:"started_time"`
	EndTime      time.Time `json:"end_time"`
}

func GetRun

func GetRun(runID int64) (*RunHistory, error)

type RunningPlan

type RunningPlan struct {
	CollectionID int64     `json:"collection_id"`
	PlanID       int64     `json:"plan_id"`
	StartedTime  time.Time `json:"started_time"`
}

func GetRunningCollections

func GetRunningCollections() ([]*RunningPlan, error)

func GetRunningPlan

func GetRunningPlan(collectionID, planID int64) (*RunningPlan, error)

func GetRunningPlans

func GetRunningPlans() ([]*RunningPlan, error)

func GetRunningPlansByCollection

func GetRunningPlansByCollection(collectionID int64) ([]*RunningPlan, error)

type ShibuyaFile

type ShibuyaFile struct {
	Filename     string `json:"filename"` // Name of the file - a.txt
	Filepath     string `json:"filepath"` // Relative path of the file - /plan/22/a.txt
	Filelink     string `json:"filelink"` // Full url for users to download the file - storage.com/shibuya/plan/22/a.txt
	TotalSplits  int    `json:"total_splits"`
	CurrentSplit int    `json:"current_split"`
}

Jump to

Keyboard shortcuts

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