models

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: Apache-2.0 Imports: 4 Imported by: 24

Documentation

Index

Constants

View Source
const (
	MethodGet     Method = "GET"
	MethodPut            = "PUT"
	MethodHead           = "HEAD"
	MethodPost           = "POST"
	MethodPatch          = "PATCH" // RFC 5789
	MethodDelete         = "DELETE"
	MethodOptions        = "OPTIONS"
	MethodTrace          = "TRACE"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	ID      string `json:"id" bson:"_id"`
	Created int64  `json:"created_at" bson:"created,omitempty"`
	Updated int64  `json:"updated" bson:"updated,omitempty"`
	CID     string `json:"cid" bson:"CID"`
}

type AppDB

type AppDB interface {
	GetByCompany(ctx context.Context, cid string) ([]*App, error)
	Exists(ctx context.Context, cid, id string) (bool, error)
	Put(ctx context.Context, a *App) error
}

type BodySegment

type BodySegment struct {
	Normal    bool
	Missing   bool
	Type      SegmentType
	ValueType SegmentValueType
	Key       string
	Value     *BodySegment
	String    string
	Number    float64
	Bool      bool
	Array     []BodySegment
}

type BrowserMock added in v0.5.0

type BrowserMock struct {
	ID       string                     `json:"id" bson:"_id"`
	Created  int64                      `json:"created" bson:"created,omitempty"`
	Updated  int64                      `json:"updated" bson:"updated,omitempty"`
	AppID    string                     `json:"app_id" bson:"app_id,omitempty"`
	TestName string                     `json:"test_name" bson:"test_name,omitempty"`
	Deps     []map[string]FetchResponse `json:"deps" bson:"deps,omitempty"`
}

type BrowserMockDB added in v0.5.0

type BrowserMockDB interface {
	Put(context.Context, BrowserMock) error
	Get(ctx context.Context, app string, testName string) ([]BrowserMock, error)
	CountDocs(ctx context.Context, app string, testName string) (int64, error)
	UpdateArr(ctx context.Context, app string, testName string, doc BrowserMock) error
}

type Dependency

type Dependency struct {
	Name string            `json:"name" bson:"name,omitempty"`
	Type DependencyType    `json:"type" bson:"type,omitempty"`
	Meta map[string]string `json:"meta" bson:"meta,omitempty"`
	Data [][]byte          `json:"data" bson:"data,omitempty"`
}

type DependencyType

type DependencyType string
const (
	NoSqlDB    DependencyType = "NO_SQL_DB"
	SqlDB      DependencyType = "SQL_DB"
	GRPC       DependencyType = "GRPC"
	HttpClient DependencyType = "HTTP_CLIENT"
)

type FetchResponse added in v0.4.2

type FetchResponse struct {
	Status       int               `json:"status" bson:"status,omitempty"`
	Headers      map[string]string `json:"headers" bson:"headers,omitempty"`
	Body         interface{}       `json:"body" bson:"body,omitempty"`
	ResponseType string            `json:"response_type" bson;"response_type"`
}

type GenericSpec added in v0.5.2

type GenericSpec struct {
	Metadata map[string]string `json:"metadata" yaml:"metadata"`
	Objects  []Object          `json:"objects" yaml:"objects"`
}

type HttpReq

type HttpReq struct {
	Method     Method            `json:"method" bson:"method,omitempty" yaml:"method"`
	ProtoMajor int               `json:"proto_major" bson:"proto_major,omitempty" yaml:"proto_major"` // e.g. 1
	ProtoMinor int               `json:"proto_minor" bson:"proto_minor,omitempty" yaml:"proto_minor"` // e.g. 0
	URL        string            `json:"url" bson:"url,omitempty" yaml:"url"`
	URLParams  map[string]string `json:"url_params" bson:"url_params,omitempty" yaml:"url_params,omitempty"`
	Header     http.Header       `json:"header" bson:"header,omitempty" yaml:"headers"`
	Body       string            `json:"body" bson:"body,omitempty" yaml:"body"`
}

type HttpResp

type HttpResp struct {
	StatusCode int         `json:"status_code" bson:"status_code,omitempty" yaml:"status_code"` // e.g. 200
	Header     http.Header `json:"header" bson:"header,omitempty" yaml:"headers"`
	Body       string      `json:"body" bson:"body,omitempty" yaml:"body"`
}

type HttpSpec added in v0.5.2

type HttpSpec struct {
	Metadata   map[string]string   `json:"metadata" yaml:"metadata"`
	Request    MockHttpReq         `json:"req" yaml:"req"`
	Response   MockHttpResp        `json:"resp" yaml:"resp"`
	Objects    []Object            `json:"objects" yaml:"objects"`
	Mocks      []string            `json:"mocks" yaml:"mocks,omitempty"`
	Assertions map[string][]string `json:"assertions" yaml:"assertions,omitempty"`
	Created    int64               `json:"created" yaml:"created,omitempty"`
}

type Kind added in v0.5.2

type Kind string
const (
	HTTP_EXPORT    Kind = "Http"
	GENERIC_EXPORT Kind = "Generic"
)

type Method

type Method string

type Mock added in v0.4.2

type Mock struct {
	Version string    `json:"version" yaml:"version"`
	Kind    string    `json:"kind" yaml:"kind"`
	Name    string    `json:"name" yaml:"name"`
	Spec    yaml.Node `json:"spec" yaml:"spec"`
}

type MockHttpReq added in v0.5.5

type MockHttpReq struct {
	Method     Method            `json:"method" yaml:"method"`
	ProtoMajor int               `json:"proto_major" yaml:"proto_major"` // e.g. 1
	ProtoMinor int               `json:"proto_minor" yaml:"proto_minor"` // e.g. 0
	URL        string            `json:"url" yaml:"url"`
	URLParams  map[string]string `json:"url_params" yaml:"url_params,omitempty"`
	Header     map[string]string `json:"header" yaml:"header"`
	Body       string            `json:"body" yaml:"body"`
}

type MockHttpResp added in v0.5.5

type MockHttpResp struct {
	StatusCode int               `json:"status_code" yaml:"status_code"` // e.g. 200
	Header     map[string]string `json:"header" yaml:"header"`
	Body       string            `json:"body" yaml:"body"`
}

type Object added in v0.5.0

type Object struct {
	Type string `json:"type" yaml:"type"`
	Data string `json:"data" yaml:"data"`
}

type SegmentType

type SegmentType string
const (
	ROOT  SegmentType = "ROOT"
	KEY   SegmentType = "KEY"
	VALUE SegmentType = "VALUE"
)

type SegmentValueType

type SegmentValueType string
const (
	STRING SegmentValueType = "STRING"
	NUMBER SegmentValueType = "NUMBER"
	BOOL   SegmentValueType = "BOOL"
	NULL   SegmentValueType = "NULL"
	ARRAY  SegmentValueType = "ARRAY"
	OBJECT SegmentValueType = "OBJECT"
)

type TeleEvent added in v0.4.0

type TeleEvent struct {
	InstallationID string                 `json:"installationId"`
	EventType      string                 `json:"eventType"`
	Meta           map[string]interface{} `json:"meta"`
	CreatedAt      int64                  `json:"createdAt"`
	TeleCheck      bool                   `json:"tele_check"`
}

type TestCase

type TestCase struct {
	ID       string              `json:"id" bson:"_id"`
	Created  int64               `json:"created" bson:"created,omitempty"`
	Updated  int64               `json:"updated" bson:"updated,omitempty"`
	Captured int64               `json:"captured" bson:"captured,omitempty"`
	CID      string              `json:"cid" bson:"cid,omitempty"`
	AppID    string              `json:"app_id" bson:"app_id,omitempty"`
	URI      string              `json:"uri" bson:"uri,omitempty"`
	HttpReq  HttpReq             `json:"http_req" bson:"http_req,omitempty"`
	HttpResp HttpResp            `json:"http_resp" bson:"http_resp,omitempty"`
	Deps     []Dependency        `json:"deps" bson:"deps,omitempty"`
	AllKeys  map[string][]string `json:"all_keys" bson:"all_keys,omitempty"`
	Anchors  map[string][]string `json:"anchors" bson:"anchors,omitempty"`
	Noise    []string            `json:"noise" bson:"noise,omitempty"`
	Mocks    []*proto.Mock       `json:"mocks"`
}

type TestCaseDB

type TestCaseDB interface {
	Upsert(context.Context, TestCase) error
	UpdateTC(context.Context, TestCase) error
	Get(ctx context.Context, cid, id string) (TestCase, error)
	Delete(ctx context.Context, id string) error
	GetAll(ctx context.Context, cid, app string, anchors bool, offset int, limit int) ([]TestCase, error)
	GetKeys(ctx context.Context, cid, app, uri string) ([]TestCase, error)
	//Exists(context.Context, TestCase) (bool, error)
	DeleteByAnchor(ctx context.Context, cid, app, uri string, filterKeys map[string][]string) error
	GetApps(ctx context.Context, cid string) ([]string, error)
}

type Version added in v0.5.2

type Version string
const (
	V1_BETA1 Version = Version("api.keploy.io/v1beta1")
)

Jump to

Keyboard shortcuts

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