types

package
v0.0.0-...-079c800 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const AuthorizationHeader = "Authorization"

AuthorizationHeader constant

View Source
const ContentLengthHeader = "Content-Length"

ContentLengthHeader header

View Source
const ContentTypeHeader = "Content-Type"

ContentTypeHeader header

View Source
const MockChaosEnabled = "X-Mock-Chaos-Enabled"

MockChaosEnabled header

View Source
const MockGroup = "X-Mock-Group"

MockGroup header

View Source
const MockPlayback = "X-Mock-Playback"

MockPlayback header

View Source
const MockRecordMode = "X-Mock-Record"

MockRecordMode header

View Source
const MockRecordModeDisabled = "false"

MockRecordModeDisabled disabled value

View Source
const MockRecordModeEnabled = "true"

MockRecordModeEnabled enabled value

View Source
const MockRequestCount = "X-Mock-Request-Count"

MockRequestCount header

View Source
const MockResponseStatus = "X-Mock-Response-Status"

MockResponseStatus header

View Source
const MockScenarioHeader = "X-Mock-Scenario"

MockScenarioHeader header

View Source
const MockScenarioPath = "X-Mock-Path"

MockScenarioPath header

View Source
const MockURL = "X-Mock-Url"

MockURL header

View Source
const MockWaitBeforeReply = "X-Mock-Wait-Before-Reply"

MockWaitBeforeReply header

View Source
const ScenarioExt = ".yaml"

ScenarioExt extension

Variables

This section is empty.

Functions

func AddAssertion

func AddAssertion(assertions []string, assert string) []string

AddAssertion helper method

func MatchPathGroups

func MatchPathGroups(rawPath string, targetPath string) (res map[string]string)

MatchPathGroups return match groups for dynamic params in path

func NormalizeDirPath

func NormalizeDirPath(path string) string

NormalizeDirPath normalizes dir path

func NormalizeGroup

func NormalizeGroup(title string, path string) string

NormalizeGroup normalizes group name

func NormalizePath

func NormalizePath(path string, sepChar uint8) string

NormalizePath normalizes path

func SanitizeNonAlphabet

func SanitizeNonAlphabet(name string, rep string) string

SanitizeNonAlphabet helper method

func SanitizeRegexValue

func SanitizeRegexValue(val string) string

SanitizeRegexValue sanitizes (val string) string {

Types

type APIAuthorization

type APIAuthorization struct {
	Type   string `json:"type,omitempty" yaml:"type,omitempty"`
	Name   string `json:"name,omitempty" yaml:"name,omitempty"`
	In     string `json:"in,omitempty" yaml:"in,omitempty"`
	Format string `json:"format,omitempty" yaml:"format,omitempty"`
	Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
	URL    string `json:"url,omitempty" yaml:"url,omitempty"`
}

APIAuthorization defines mock auth parameters

type APIKeyData

type APIKeyData struct {
	// Method for HTTP API
	Method MethodType `yaml:"method" json:"method"`
	// Name to uniquely identify the scenario
	Name string `yaml:"name" json:"name"`
	// Path for the API (excluding query params)
	Path string `yaml:"path" json:"path"`
	// Order of scenario
	Order int `yaml:"order" json:"order"`
	// Group of scenario
	Group string `yaml:"group" json:"group"`
	// Tags of scenario
	Tags []string `yaml:"tags" json:"tags"`
	// Predicate for the request
	Predicate string `yaml:"predicate" json:"predicate"`
	// AssertQueryParamsPattern for the API
	AssertQueryParamsPattern map[string]string `yaml:"assert_query_params_pattern" json:"assert_query_params_pattern"`
	// AssertPostParamsPattern for the API
	AssertPostParamsPattern map[string]string `yaml:"assert_post_params_pattern" json:"assert_post_params_pattern"`
	// AssertHeadersPattern for api response
	AssertHeadersPattern map[string]string `yaml:"assert_headers_pattern" json:"assert_headers_pattern"`
	// AssertContentsPattern for request optionally
	AssertContentsPattern string `yaml:"assert_contents_pattern" json:"assert_contents_pattern"`
	// LastUsageTime of key data
	LastUsageTime int64
	// RequestCount for the API
	RequestCount uint64
}

APIKeyData defines keys of api scenario for in-memory store

func (*APIKeyData) Equals

func (kd *APIKeyData) Equals(other *APIKeyData) error

Equals compares path and query path

func (*APIKeyData) MatchGroups

func (kd *APIKeyData) MatchGroups(path string) map[string]string

MatchGroups return match groups for dynamic params in path

func (*APIKeyData) MethodNamePathPrefixKey

func (kd *APIKeyData) MethodNamePathPrefixKey() string

MethodNamePathPrefixKey returns full key for the scenario

func (*APIKeyData) MethodPath

func (kd *APIKeyData) MethodPath() string

MethodPath helper method

func (*APIKeyData) PartialMethodPathKey

func (kd *APIKeyData) PartialMethodPathKey() string

PartialMethodPathKey for key by method and first-level path

func (*APIKeyData) PathPrefix

func (kd *APIKeyData) PathPrefix(max int) string

PathPrefix builds prefix of path

func (*APIKeyData) SafeName

func (kd *APIKeyData) SafeName() string

SafeName strips invalid characters

func (*APIKeyData) String

func (kd *APIKeyData) String() string

String

func (*APIKeyData) Validate

func (kd *APIKeyData) Validate() error

Validate scenario

type APIRequest

type APIRequest struct {
	// PathParams for the API
	PathParams map[string]string `yaml:"path_params" json:"path_params"`
	// QueryParams for the API
	QueryParams map[string]string `yaml:"query_params" json:"query_params"`
	// PostParams for the API
	PostParams map[string]string `yaml:"post_params" json:"post_params"`
	// Headers for mock response
	Headers map[string]string `yaml:"headers" json:"headers"`
	// Contents for request optionally
	Contents string `yaml:"contents" json:"contents"`
	// ExampleContents sample for request optionally
	ExampleContents string `yaml:"example_contents" json:"example_contents"`
	// HTTPVersion version of http
	HTTPVersion string `yaml:"http_version" json:"http_version"`
	// AssertQueryParamsPattern for the API
	AssertQueryParamsPattern map[string]string `yaml:"assert_query_params_pattern" json:"assert_query_params_pattern"`
	// AssertPostParamsPattern for the API
	AssertPostParamsPattern map[string]string `yaml:"assert_post_params_pattern" json:"assert_post_params_pattern"`
	// AssertHeadersPattern for mock response
	AssertHeadersPattern map[string]string `yaml:"assert_headers_pattern" json:"assert_headers_pattern"`
	// AssertContentsPattern for request optionally
	AssertContentsPattern string `yaml:"assert_contents_pattern" json:"assert_contents_pattern"`
	// Assertions for validating response
	Assertions []string `yaml:"assertions" json:"assertions"`
	// Variables to set for templates
	Variables map[string]string `yaml:"variables" json:"variables"`
}

APIRequest defines mock request for APIs

func (APIRequest) Assert

func (r APIRequest) Assert(
	queryParams map[string]string,
	postParams map[string]string,
	reqHeaders map[string][]string,
	reqContents any,
	templateParams map[string]any) error

Assert asserts response

func (APIRequest) AssertContentsPatternOrContent

func (r APIRequest) AssertContentsPatternOrContent() string

AssertContentsPatternOrContent helper method

func (APIRequest) AuthHeader

func (r APIRequest) AuthHeader() string

AuthHeader finds AuthHeaderType

func (APIRequest) BuildTemplateParams

func (r APIRequest) BuildTemplateParams(
	req *http.Request,
	pathGroups map[string]string,
	inHeaders map[string][]string,
	overrides map[string]any,
) (templateParams map[string]any, queryParams map[string]string, postParams map[string]string, reqHeaders map[string][]string)

BuildTemplateParams builds template

func (APIRequest) ContentType

func (r APIRequest) ContentType(defContentType string) string

ContentType find content-type

func (APIRequest) TargetHeader

func (r APIRequest) TargetHeader() string

TargetHeader find header matching target

type APIResponse

type APIResponse struct {
	// Headers for mock response
	Headers map[string][]string `yaml:"headers" json:"headers"`
	// Contents for request
	Contents string `yaml:"contents" json:"contents"`
	// ContentsFile for request
	ContentsFile string `yaml:"contents_file" json:"contents_file"`
	// ExampleContents sample for response optionally
	ExampleContents string `yaml:"example_contents" json:"example_contents"`
	// StatusCode for response
	StatusCode int `yaml:"status_code" json:"status_code"`
	// HTTPVersion version of http
	HTTPVersion string `yaml:"http_version" json:"http_version"`
	// SetVariables to set shared variables from response
	SetVariables []string `yaml:"set_variables" json:"set_variables"`
	// UnsetVariables to reset shared variables
	UnsetVariables []string `yaml:"unset_variables" json:"unset_variables"`
	// AssertHeadersPattern for mock response
	AssertHeadersPattern map[string]string `yaml:"assert_headers_pattern" json:"assert_headers_pattern"`
	// AssertContentsPattern for request optionally
	AssertContentsPattern string `yaml:"assert_contents_pattern" json:"assert_contents_pattern"`
	// Assertions for validating response
	Assertions []string `yaml:"assertions" json:"assertions"`
}

APIResponse defines mock response for APIs

func (APIResponse) Assert

func (r APIResponse) Assert(
	resHeaders map[string][]string,
	resContents any,
	templateParams map[string]any) error

Assert asserts response

func (APIResponse) AssertContentsPatternOrContent

func (r APIResponse) AssertContentsPatternOrContent() string

AssertContentsPatternOrContent helper method

func (APIResponse) ContentType

func (r APIResponse) ContentType(defContentType string) string

ContentType find content-type

type APIScenario

type APIScenario struct {
	// Method for HTTP API
	Method MethodType `yaml:"method" json:"method"`
	// Name to uniquely identify the scenario
	Name string `yaml:"name" json:"name"`
	// Path for the API (excluding query params)
	Path string `yaml:"path" json:"path"`
	// BaseURL of remote server
	BaseURL string `yaml:"base_url" json:"base_url"`
	// Description of scenario
	Description string `yaml:"description" json:"description"`
	// Order of scenario
	Order int `yaml:"order" json:"order"`
	// Group of scenario
	Group string `yaml:"group" json:"group"`
	// Tags of scenario
	Tags []string `yaml:"tags" json:"tags"`
	// Predicate for the request
	Predicate string `yaml:"predicate" json:"predicate"`
	// Authentication for the API
	Authentication map[string]APIAuthorization `yaml:"authentication" json:"authentication"`
	// Request for the API
	Request APIRequest `yaml:"request" json:"request"`
	// Response for the API
	Response APIResponse `yaml:"response" json:"response"`
	// WaitMillisBeforeReply for response
	WaitBeforeReply time.Duration `yaml:"wait_before_reply" json:"wait_before_reply"`
	// StartTime of request
	StartTime time.Time `yaml:"start_time" json:"start_time"`
	// EndTime of request
	EndTime time.Time `yaml:"end_time" json:"end_time"`
	// RequestCount of request
	RequestCount uint64 `yaml:"-" json:"-"`
}

APIScenario defines mock scenario for APIs

func BuildScenarioFromHTTP

func BuildScenarioFromHTTP(
	config *Configuration,
	prefix string,
	u *url.URL,
	method string,
	group string,
	reqHTTPVersion string,
	resHTTPVersion string,
	reqBody []byte,
	resBody []byte,
	queryParams map[string][]string,
	postParams map[string][]string,
	reqHeaders map[string][]string,
	reqContentType string,
	resHeaders map[string][]string,
	resContentType string,
	resStatus int,
	started time.Time,
	ended time.Time,
) (*APIScenario, error)

BuildScenarioFromHTTP helper method

func BuildTestScenario

func BuildTestScenario(method MethodType, name string, path string, n int) *APIScenario

BuildTestScenario helper method

func (*APIScenario) BuildName

func (api *APIScenario) BuildName(prefix string) string

BuildName builds name

func (*APIScenario) BuildURL

func (api *APIScenario) BuildURL(overrideBaseURL string) string

BuildURL helper method

func (*APIScenario) Digest

func (api *APIScenario) Digest() string

Digest of scenario

func (*APIScenario) GetEndTime

func (api *APIScenario) GetEndTime() time.Time

GetEndTime helper method

func (*APIScenario) GetMillisTime

func (api *APIScenario) GetMillisTime() int64

GetMillisTime helper method

func (*APIScenario) GetNetURL

func (api *APIScenario) GetNetURL(u *url.URL) (*url.URL, error)

GetNetURL helper method

func (*APIScenario) GetStartTime

func (api *APIScenario) GetStartTime() time.Time

GetStartTime helper method

func (*APIScenario) GetURL

func (api *APIScenario) GetURL(defBase string) (u *url.URL, err error)

GetURL helper method

func (*APIScenario) HasURL

func (api *APIScenario) HasURL() bool

HasURL helper method

func (*APIScenario) MethodPath

func (api *APIScenario) MethodPath() string

MethodPath helper method

func (*APIScenario) MethodPathTarget

func (api *APIScenario) MethodPathTarget() string

MethodPathTarget helper method

func (*APIScenario) NormalName

func (api *APIScenario) NormalName() string

NormalName normalizes name from path

func (*APIScenario) NormalPath

func (api *APIScenario) NormalPath(sep uint8) string

NormalPath normalizes path

func (*APIScenario) SafeName

func (api *APIScenario) SafeName() string

SafeName strips invalid characters

func (*APIScenario) SetName

func (api *APIScenario) SetName(prefix string)

SetName sets name

func (*APIScenario) String

func (api *APIScenario) String() string

String

func (*APIScenario) ToKeyData

func (api *APIScenario) ToKeyData() *APIKeyData

ToKeyData converts scenario to key data

func (*APIScenario) Validate

func (api *APIScenario) Validate() error

Validate scenario

type AWSConfig

type AWSConfig struct {
	StripRequestHeaders   []string `yaml:"strip" mapstructure:"strip" env:"AWS_STRIP_HEADERS"`
	SigningNameOverride   string   `yaml:"name" mapstructure:"name" env:"AWS_SIGNING_NAME"`
	SigningRegionOverride string   `yaml:"aws_region" mapstructure:"aws_region" env:"AWS_REGION"`
	SigningHostOverride   string   `yaml:"sign_host" mapstructure:"sign_host" env:"AWS_SIGN_HOST"`
	HostOverride          string   `yaml:"host" mapstructure:"host" env:"AWS_HOST"`
	ResignAllRequests     bool     `yaml:"resign_all_requests" mapstructure:"resign_all_requests" env:"AWS_RESIGN_ALL_REQUESTS"`
	ResignOnlyExpiredDate bool     `yaml:"resign_only_expired_date" mapstructure:"resign_only_expired_date" env:"AWS_RESIGN_ONLY_EXPIRED"`
	Debug                 bool     `yaml:"debug" mapstructure:"debug" env:"AWS_DEBUG"`
}

AWSConfig config

type AuthType

type AuthType string

AuthType for API authorization

const (
	// APIKey stands for API Key Authentication.
	APIKey AuthType = "apikey"
	// AWSV4 is Amazon AWS Authentication.
	AWSV4 AuthType = "awsv4"
	// Basic Authentication.
	Basic AuthType = "basic"
	// Bearer Token Authentication.
	Bearer AuthType = "bearer"
	// Digest Authentication.
	Digest AuthType = "digest"
	// Hawk Authentication.
	Hawk AuthType = "hawk"
	// NoAuth Authentication.
	NoAuth AuthType = "noauth"
	// OAuth1 Authentication.
	OAuth1 AuthType = "oauth1"
	// OAuth2 Authentication.
	OAuth2 AuthType = "oauth2"
	// NTLM Authentication.
	NTLM AuthType = "ntlm"
)

type BasicAuthConfig

type BasicAuthConfig struct {
	Username string `yaml:"username" mapstructure:"username" env:"USERNAME"`
	Password string `yaml:"password" mapstructure:"password" env:"PASSWORD"`
}

BasicAuthConfig config

type Configuration

type Configuration struct {
	// HTTPPort for server
	HTTPPort int `yaml:"http_port" mapstructure:"http_port" env:"HTTP_PORT"`
	// ProxyPort for server
	ProxyPort int `yaml:"proxy_port" mapstructure:"proxy_port" env:"PROXY_PORT"`
	// ProxyURLFilter for filtering url
	ProxyURLFilter string `yaml:"proxy_url_filter" mapstructure:"proxy_url_filter" env:"PROXY_URL_FILTER"`
	// ConnectionTimeout for remote server
	ConnectionTimeout int `yaml:"connection_timeout" mapstructure:"connection_timeout"`
	// DataDir for storing api scenarios, history, fixtures, assets, etc.
	DataDir string `yaml:"data_dir" mapstructure:"data_dir" env:"DATA_DIR"`
	// MaxHistory for max limit of storing execution history
	MaxHistory int `yaml:"max_history" mapstructure:"max_history" env:"MAX_HISTORY"`
	// UserAgent for mock api server
	UserAgent string `yaml:"user_agent" mapstructure:"user_agent" env:"USER_AGENT"`
	// ProxyURL for mock api server
	ProxyURL string `yaml:"proxy_url" mapstructure:"proxy_url" env:"PROXY_URL"`
	// AssertHeadersPattern to always match HTTP headers and store them in match-header property of api scenario
	AssertHeadersPattern string `yaml:"assert_headers_pattern" mapstructure:"assert_headers_pattern" env:"ASSERT_HEADERS_PATTERN"`
	// AssertQueryParamsPattern to always match HTTP query params and store them in match-query parameters of api scenario
	AssertQueryParamsPattern string `yaml:"assert_query_params_pattern" mapstructure:"assert_query_params_pattern" env:"ASSERT_QUERY_PATTERN"`
	// AssertPostParamsPattern to always match HTTP post params and store them in match-query parameters of api scenario
	AssertPostParamsPattern string `yaml:"assert_post_params_pattern" mapstructure:"assert_post_params_pattern" env:"ASSERT_POST_PATTERN"`
	CORS                    string `yaml:"cors" mapstructure:"cors" env:"MOCK_CORS"`
	RecordOnly              bool   `yaml:"record_only" mapstructure:"record_only" env:"RECORD_ONLY"`
	Debug                   bool   `yaml:"debug" mapstructure:"debug" env:"MOCK_DEBUG"`
	// Version of API
	Version *Version `yaml:"-" mapstructure:"-" json:"-"`
	// UserAgent for mock api server
	AuthBearerToken string `yaml:"auth_bearer_token" mapstructure:"auth_bearer_token" env:"AUTH_TOKEN"`
	// AWSConfig
	AWS AWSConfig `yaml:"aws" mapstructure:"aws"`
	// BasicAuth
	BasicAuth BasicAuthConfig `yaml:"basic_auth" mapstructure:"basic_auth"`
}

Configuration for mock api service

func BuildTestConfig

func BuildTestConfig() *Configuration

BuildTestConfig helper method

func NewConfiguration

func NewConfiguration(
	httpPort int,
	proxyPort int,
	dataDir string,
	version *Version) (config *Configuration, err error)

NewConfiguration -- Initializes the default config

func (*Configuration) AssertHeader

func (c *Configuration) AssertHeader(h string) bool

AssertHeader match header

func (*Configuration) AssertPostParams

func (c *Configuration) AssertPostParams(p string) bool

AssertPostParams match post params

func (*Configuration) AssertQueryParams

func (c *Configuration) AssertQueryParams(p string) bool

AssertQueryParams match query params

type GroupConfig

type GroupConfig struct {
	// Variables to set for templates
	Variables map[string]string `json:"variables" mapstructure:"variables"`
	// ChaosEnabled to enable faults and delays
	ChaosEnabled bool `json:"chaos_enabled" mapstructure:"chaos_enabled"`
	// MeanTimeBetweenFailure for failure
	MeanTimeBetweenFailure float64 `json:"mean_time_between_failure" mapstructure:"mean_time_between_failure"`
	// MeanTimeBetweenAdditionalLatency for adding delay
	MeanTimeBetweenAdditionalLatency float64 `json:"mean_time_between_additional_latency" mapstructure:"mean_time_between_additional_latency"`
	// MaxAdditionalLatency for max delay
	MaxAdditionalLatencySecs float64 `json:"max_additional_latency_secs" mapstructure:"max_additional_latency_secs"`
	// HTTPErrors to return for failure
	HTTPErrors []int `json:"http_errors" mapstructure:"http_errors"`
	// contains filtered or unexported fields
}

GroupConfig for group configuration

func (*GroupConfig) GetDelayLatency

func (gc *GroupConfig) GetDelayLatency() time.Duration

GetDelayLatency calculates latency

func (*GroupConfig) GetHTTPStatus

func (gc *GroupConfig) GetHTTPStatus() int

GetHTTPStatus accessor

type MethodType

type MethodType string

MethodType for HTTP

const (
	// Get HTTP request
	Get MethodType = "GET"
	// Post HTTP request
	Post MethodType = "POST"
	// Put HTTP request
	Put MethodType = "PUT"
	// Delete HTTP request
	Delete MethodType = "DELETE"
	// Option HTTP request
	Option MethodType = "OPTION"
	// Head HTTP request
	Head MethodType = "HEAD"
	// Patch HTTP request
	Patch MethodType = "PATCH"
	// Connect HTTP request
	Connect MethodType = "CONNECT"
	// Options HTTP request
	Options MethodType = "OPTIONS"
	// Trace HTTP request
	Trace MethodType = "TRACE"
	// Copy HTTP Method.
	Copy MethodType = "COPY"
	// Link HTTP Method.
	Link MethodType = "LINK"
	// Unlink HTTP Method.
	Unlink MethodType = "UNLINK"
	// Purge HTTP Method.
	Purge MethodType = "PURGE"
	// Lock HTTP Method.
	Lock MethodType = "LOCK"
	// Unlock HTTP Method.
	Unlock MethodType = "UNLOCK"
	// Propfind HTTP Method.
	Propfind MethodType = "PROPFIND"
	// View HTTP Method.
	View MethodType = "VIEW"
)

func ToMethod

func ToMethod(val string) (MethodType, error)

ToMethod converts string to method

type NotFoundError

type NotFoundError struct {
	Message string
}

NotFoundError error

func NewNotFoundError

func NewNotFoundError(msg string) *NotFoundError

NewNotFoundError constructor

func (*NotFoundError) Error

func (ne *NotFoundError) Error() string

type ProducerContractRequest

type ProducerContractRequest struct {
	// BaseURL of remote server
	BaseURL string `yaml:"base_url" json:"base_url"`
	// ExecutionTimes for contract testing
	ExecutionTimes int `yaml:"execution_times" json:"execution_times"`
	// Verbose setting
	Verbose bool `yaml:"verbose" json:"verbose"`
	// Headers overrides
	Headers map[string][]string `yaml:"-" json:"-"`
	// Params local overrides
	Params map[string]any `yaml:"-" json:"-"`
}

ProducerContractRequest for generating fuzz-data requests to an API implementation for producer based contract testing

func NewProducerContractRequest

func NewProducerContractRequest(baseURL string, execTimes int) *ProducerContractRequest

NewProducerContractRequest constructor

func (*ProducerContractRequest) Overrides

func (req *ProducerContractRequest) Overrides() map[string]any

Overrides helper methods to aggregate headers and params

func (*ProducerContractRequest) String

func (req *ProducerContractRequest) String() string

type ProducerContractResponse

type ProducerContractResponse struct {
	Results   map[string]string  `yaml:"results" json:"results"`
	Errors    map[string]string  `yaml:"errors" json:"errors"`
	Metrics   map[string]float64 `yaml:"metrics" json:"metrics"`
	URLs      map[string]int     `yaml:"urls" json:"urls"`
	Succeeded int                `yaml:"succeeded" json:"succeeded"`
	Failed    int                `yaml:"failed" json:"failed"`
}

ProducerContractResponse for returning summary of producer based test results

func NewProducerContractResponse

func NewProducerContractResponse() *ProducerContractResponse

NewProducerContractResponse constructor

func (*ProducerContractResponse) Add

func (cr *ProducerContractResponse) Add(key string, res any, err error)

Add result or error

type ValidationError

type ValidationError struct {
	Message string
}

ValidationError error

func NewValidationError

func NewValidationError(msg string) *ValidationError

NewValidationError constructor

func (*ValidationError) Error

func (ve *ValidationError) Error() string

type Version

type Version struct {
	Version string    `json:"version,omitempty"`
	Commit  string    `json:"commit,omitempty"`
	Date    string    `json:"date,omitempty"`
	Started time.Time `json:"started,omitempty"`
}

Version creates a formatted struct for output

func NewVersion

func NewVersion(version string, commit string, date string) *Version

NewVersion will create a pointer to a new version object

func (*Version) Output

func (v *Version) Output(shortened bool) string

Output will add the versioning code

func (*Version) String

func (v *Version) String() string

func (*Version) ToJSON

func (v *Version) ToJSON() string

ToJSON converts the Version into a JSON String

func (*Version) ToShortened

func (v *Version) ToShortened() string

ToShortened converts the Version into a JSON String

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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