mock

package
v1.0.15 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2019 License: CC0-1.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFoundry

type CloudFoundry struct{}

CloudFoundry mock implementation.

func (CloudFoundry) Configure

func (env CloudFoundry) Configure()

Configure the settings per the CloudFoundry environment.

type DatabaseService

type DatabaseService struct {
	SelectFn    func(query interface{}) error
	SelectCount int
}

DatabaseService mock implementation.

func (*DatabaseService) Array

func (service *DatabaseService) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{})

Array fills an array from the model and expression.

func (*DatabaseService) CheckTable

func (service *DatabaseService) CheckTable(entity interface{}) error

CheckTable ensures a the table exists for the persistor.

func (*DatabaseService) ColumnsWhere

func (service *DatabaseService) ColumnsWhere(model interface{}, columns []string, condition string, params ...interface{}) error

ColumnsWhere is a Conditional selection based on the model in the data store only returning specific quoted columns.

func (*DatabaseService) Configure

func (service *DatabaseService) Configure()

Configure establishes a new database connection

func (*DatabaseService) Count

func (service *DatabaseService) Count(model interface{}, condition string, params ...interface{}) int

Count return the number of rows found.

func (*DatabaseService) CountExpr

func (service *DatabaseService) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{})

CountExpr return the number of rows found with an expression.

func (*DatabaseService) Delete

func (service *DatabaseService) Delete(query interface{}) error

Delete removes the model from the data store

func (*DatabaseService) Find

func (service *DatabaseService) Find(query interface{}, callback func(query interface{}))

Find will check if the model exists and run the additional functionality.

func (*DatabaseService) FindAll

func (service *DatabaseService) FindAll(model interface{}) error

FindAll instances of a type of model.

func (*DatabaseService) Insert

func (service *DatabaseService) Insert(query ...interface{}) error

Insert persists the new model in the data store

func (*DatabaseService) Raw

func (service *DatabaseService) Raw(query interface{}, params ...interface{}) error

Raw executes a string of SQL.

func (*DatabaseService) Save

func (service *DatabaseService) Save(query ...interface{}) error

Save persists the model in the data store

func (*DatabaseService) Select

func (service *DatabaseService) Select(query interface{}) error

Select returns the model from the data store

func (*DatabaseService) Update

func (service *DatabaseService) Update(query interface{}) error

Update persists the existing model in the data store

func (*DatabaseService) Where

func (service *DatabaseService) Where(model interface{}, condition string, params ...interface{}) error

Where is a conditional selection based on the model in the data store.

type Geocoder

type Geocoder struct{}

Geocoder is a mock implementation.

func (Geocoder) Validate

func (service Geocoder) Validate(api.GeocodeValues) (api.GeocodeResults, error)

Validate takes values to be geocoded and executes a web service call

type LogService

type LogService struct {
	Off bool
	// contains filtered or unexported fields
}

LogService mock implementation of logging.

func (*LogService) AddField

func (service *LogService) AddField(name string, value interface{})

AddField will add a field using the name and value to the logger.

func (*LogService) Debug

func (service *LogService) Debug(message string, fields api.LogFields)

Debug outputs a debug message to the log.

func (*LogService) DebugError

func (service *LogService) DebugError(message string, err error, fields api.LogFields)

DebugError outputs a debug message and error to the log.

func (*LogService) Fatal

func (service *LogService) Fatal(message string, fields api.LogFields)

Fatal outputs a fatal message to the log.

func (*LogService) FatalError

func (service *LogService) FatalError(message string, err error, fields api.LogFields)

FatalError outputs a fatal message and error to the log.

func (*LogService) Info

func (service *LogService) Info(message string, fields api.LogFields)

Info outputs a informative message to the log.

func (*LogService) InfoError

func (service *LogService) InfoError(message string, err error, fields api.LogFields)

InfoError outputs a informative message and error to the log.

func (*LogService) Panic

func (service *LogService) Panic(message string, fields api.LogFields)

Panic outputs a panic message to the log.

func (*LogService) PanicError

func (service *LogService) PanicError(message string, err error, fields api.LogFields)

PanicError outputs a panic message and error to the log.

func (*LogService) Print

func (service *LogService) Print(message string, fields api.LogFields)

Print outputs a message to the log.

func (*LogService) PrintError

func (service *LogService) PrintError(message string, err error, fields api.LogFields)

PrintError outputs a message and error to the log.

func (*LogService) Warn

func (service *LogService) Warn(message string, fields api.LogFields)

Warn outputs a warning message to the log.

func (*LogService) WarnError

func (service *LogService) WarnError(message string, err error, fields api.LogFields)

WarnError outputs a warning message and error to the log.

type Native

type Native struct{}

Native is a mock (not really) implementation.

func (Native) Configure

func (env Native) Configure()

Configure the environment.

func (Native) Has

func (env Native) Has(name string) bool

Has returns if the environment has a value for the given environment variable.

func (Native) Int

func (env Native) Int(name string) int

Int returns the integer value of the given environment variable.

func (Native) String

func (env Native) String(name string) string

String returns the string value of the given environment variable.

func (Native) True

func (env Native) True(name string) bool

True returns the boolean value of the given environment variable.

type SamlService

type SamlService struct{}

SamlService mock implementation of SAML handling.

func (*SamlService) CreateAuthenticationRequest

func (service *SamlService) CreateAuthenticationRequest() (string, string, error)

CreateAuthenticationRequest creates a SAML 2.0 authentication request based on the service provider settings. If configured to sign the request then the Base64 XML will be signed.

func (*SamlService) ValidateAuthenticationResponse

func (service *SamlService) ValidateAuthenticationResponse(encoded string) (string, error)

ValidateAuthenticationResponse validations a SAML authentication response.

type TokenService

type TokenService struct{}

TokenService is a mock implementation of JWT service handling.

func (TokenService) CheckToken

func (service TokenService) CheckToken(request *http.Request) (string, int, error)

CheckToken tests if the token is valid and is of the correct audience.

func (TokenService) ConfigureEnvironment

func (service TokenService) ConfigureEnvironment(size int) error

ConfigureEnvironment ensure the secret is set prior to use.

func (TokenService) CurrentAudience

func (service TokenService) CurrentAudience(request *http.Request) string

CurrentAudience is the currently valid audience from the token.

func (TokenService) ExtractToken

func (service TokenService) ExtractToken(request *http.Request) string

ExtractToken returns the token from an HTTP request header.

func (TokenService) NewToken

func (service TokenService) NewToken(id int, audience string) (string, time.Time, error)

NewToken generates a new Jwt signed token using a users account information

func (TokenService) Secret

func (service TokenService) Secret() []byte

Secret returns the secret to use with JWT tokens.

func (TokenService) TargetAudiences

func (service TokenService) TargetAudiences() []string

TargetAudiences which are accepted based on the configured environment.

func (TokenService) Timeout

func (service TokenService) Timeout() time.Duration

Timeout returns the duration in time for how long a session is considered valid. Per policy this defaults to 15 minutes.

type XMLService

type XMLService struct{}

XMLService is a mock implementation of handling XML.

func (*XMLService) DefaultTemplate

func (service *XMLService) DefaultTemplate(templateName string, data map[string]interface{}) template.HTML

DefaultTemplate returns a template given data.

Jump to

Keyboard shortcuts

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