helper

package
v0.0.0-...-370919f Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeSegment

func DecodeSegment(seg string) ([]byte, error)

func EncodeSegment

func EncodeSegment(seg []byte) string

func ExportRsaPrivateKeyAsPemStr

func ExportRsaPrivateKeyAsPemStr(privkey *rsa.PrivateKey) string

func ExportRsaPublicKeyAsPemStr

func ExportRsaPublicKeyAsPemStr(pubkey *rsa.PublicKey) (string, error)

func GenerateRsaKeyPair

func GenerateRsaKeyPair() (*rsa.PrivateKey, *rsa.PublicKey)

func ParseMap

func ParseMap(data interface{}, dest interface{}) error

func ParseRsaPrivateKeyFromPemStr

func ParseRsaPrivateKeyFromPemStr(privPEM string) (*rsa.PrivateKey, error)

func ParseRsaPublicKeyFromPemStr

func ParseRsaPublicKeyFromPemStr(pubPEM string) (*rsa.PublicKey, error)

Types

type HttpError

type HttpError struct {
	Message string `json:"message"`
	Status  int    `json:"status"`
}

func NewHttpError

func NewHttpError(status int, message string) *HttpError

func (HttpError) Error

func (e HttpError) Error() string

type QueryExecuter

type QueryExecuter interface {
	DoQuery(query string, args ...interface{}) ([]map[string]interface{}, error)
	DoQueryRow(query string, args ...interface{}) (map[string]interface{}, error)
	DoQuerySlice(query string, args ...interface{}) ([]interface{}, error)
}

type QueryHelper

type QueryHelper struct {
	DB *sqlx.DB
}

func (*QueryHelper) DoQuery

func (q *QueryHelper) DoQuery(query string, args ...interface{}) ([]map[string]interface{}, error)

func (*QueryHelper) DoQueryRow

func (q *QueryHelper) DoQueryRow(query string, args ...interface{}) (map[string]interface{}, error)

func (*QueryHelper) DoQuerySlice

func (q *QueryHelper) DoQuerySlice(query string, args ...interface{}) ([]interface{}, error)

type QueryMockHelper

type QueryMockHelper struct {
	Data  []map[string]interface{}
	Row   map[string]interface{}
	Slice []interface{}
	Err   error
}

func (*QueryMockHelper) DoQuery

func (q *QueryMockHelper) DoQuery(query string, args ...interface{}) ([]map[string]interface{}, error)

func (*QueryMockHelper) DoQueryRow

func (q *QueryMockHelper) DoQueryRow(query string, args ...interface{}) (map[string]interface{}, error)

func (*QueryMockHelper) DoQuerySlice

func (q *QueryMockHelper) DoQuerySlice(query string, args ...interface{}) ([]interface{}, error)

type RedisExecuter

type RedisExecuter interface {
	Publish(channel string, message interface{}) error
}

type RedisHelper

type RedisHelper struct {
	Redis *redis.Client
}

func (*RedisHelper) Publish

func (r *RedisHelper) Publish(channel string, message interface{}) error

Jump to

Keyboard shortcuts

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