model

package
v0.0.0-...-79b5d29 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const CreateTableQuery string = `CREATE TABLE IF NOT EXISTS tests (
id uuid PRIMARY KEY,
name TEXT NOT NULL,
data jsonb);`

CreateTableQuery is sql query for creating fda_data table

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomDuration

type CustomDuration struct {
	time.Duration
}

custom type for destructing string representation of time durations from json

func (*CustomDuration) MarshalJSON

func (d *CustomDuration) MarshalJSON() ([]byte, error)

func (*CustomDuration) UnmarshalJSON

func (d *CustomDuration) UnmarshalJSON(b []byte) (err error)

type LoadTestComplex

type LoadTestComplex struct {
	Name     string         `json:"name"`
	Duration CustomDuration `json:"duration"` // in seconds
	TPS      int            `json:"tps"`
	Target   string         `json:"target"`
}

type LoadTestResults

type LoadTestResults struct {
	Latencies struct {
		Total   int `json:"total"`
		Mean    int `json:"mean"`
		Five0Th int `json:"50th"`
		Nine5Th int `json:"95th"`
		Nine9Th int `json:"99th"`
		Max     int `json:"max"`
	} `json:"latencies"`
	BytesIn struct {
		Total int `json:"total"`
		Mean  int `json:"mean"`
	} `json:"bytes_in"`
	BytesOut struct {
		Total int `json:"total"`
		Mean  int `json:"mean"`
	} `json:"bytes_out"`
	Earliest    time.Time `json:"earliest"`
	Latest      time.Time `json:"latest"`
	End         time.Time `json:"end"`
	Duration    int       `json:"duration"`
	Wait        int       `json:"wait"`
	Requests    int       `json:"requests"`
	Rate        float64   `json:"rate"`
	Success     int       `json:"success"`
	StatusCodes struct {
		Num200 int `json:"200"`
	} `json:"status_codes"`
	Errors []interface{} `json:"errors"`
}

type LoadTestSimple

type LoadTestSimple struct {
	Name     string         `json:"name"`
	Method   string         `json:"method"`
	Url      string         `json:"url"`
	Duration CustomDuration `json:"duration"` // in seconds
	TPS      int            `json:"tps"`
}

type Payload

type Payload struct {
	ID   string          `json:"id"`
	Name string          `json:"name"`
	Data json.RawMessage `json:"data"` // or could be []interface{}

}

type PostgresStorage

type PostgresStorage struct {
	// contains filtered or unexported fields
}

func BootstrapPostgres

func BootstrapPostgres(config *conf.DatabaseConfig) (PostgresStorage, error)

func (PostgresStorage) Delete

func (p PostgresStorage) Delete(id int) error

func (PostgresStorage) Healthy

func (p PostgresStorage) Healthy() error

func (PostgresStorage) Init

func (p PostgresStorage) Init(query string) error

func (PostgresStorage) Insert

func (p PostgresStorage) Insert(id string, itemName string, payload []byte) (int64, error)

func (PostgresStorage) Purge

func (p PostgresStorage) Purge(table string) error

func (PostgresStorage) Select

func (p PostgresStorage) Select(itemId int) ([]byte, error)

func (PostgresStorage) SelectAll

func (p PostgresStorage) SelectAll(count, start int) ([]byte, error)

func (PostgresStorage) Update

func (p PostgresStorage) Update(id int, payload Payload) error

type Storage

type Storage interface {
	Init(string) error
	Insert(string, string, []byte) (int64, error)
	Select(int) ([]byte, error)
	SelectAll(int, int) ([]byte, error)
	Update(int, Payload) error
	Delete(int) error
	Purge(string) error // deletes all items from table
	Healthy() error
}

Jump to

Keyboard shortcuts

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