common

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

README

common

-- import "github.com/Clever/sphinx/common"

Usage

func ConstructMockRequestWithHeaders
func ConstructMockRequestWithHeaders(headers map[string][]string) *http.Request

ConstructMockRequestWithHeaders constructs an http.Request with the given headers

func Hash
func Hash(str, salt string) string

Hash hashes a string based on the given salt

func InSlice
func InSlice(a string, list []string) bool

InSlice tests whether or not a string exists in a slice of strings

func ReMarshal
func ReMarshal(config interface{}, target interface{}) error

ReMarshal parses interface{} into concrete types

func SortedKeys
func SortedKeys(obj map[string]interface{}) []string

SortedKeys returns a sorted slice of map keys

type Request
type Request map[string]interface{}

Request contains any info necessary to ratelimit a request

func HTTPToSphinxRequest
func HTTPToSphinxRequest(r *http.Request) Request

HTTPToSphinxRequest converts an http.Request to a Request

Documentation

Index

Constants

This section is empty.

Variables

Log is a Kayvee.Logger singleton to be used in Sphinx

Functions

func ConstructMockRequestWithHeaders

func ConstructMockRequestWithHeaders(headers map[string][]string) *http.Request

ConstructMockRequestWithHeaders constructs an http.Request with the given headers

func Hash

func Hash(str, salt string) string

Hash hashes a string based on the given salt

func InSlice

func InSlice(a string, list []string) bool

InSlice tests whether or not a string exists in a slice of strings

func ReMarshal

func ReMarshal(config interface{}, target interface{}) error

ReMarshal parses interface{} into concrete types

func SortedKeys

func SortedKeys(obj map[string]interface{}) []string

SortedKeys returns a sorted slice of map keys

Types

type M added in v0.5.2

type M map[string]interface{}

M is an alias for map[String]interface{} to make log lines less painful to write.

func ConcatWithRequest added in v0.5.2

func ConcatWithRequest(data M, req Request) M

ConcatWithRequest concats the request to a given map[String]interface{} for use with Kayvee

type Request

type Request map[string]interface{}

Request contains any info necessary to ratelimit a request

func HTTPToSphinxRequest

func HTTPToSphinxRequest(r *http.Request) Request

HTTPToSphinxRequest converts an http.Request to a Request

Jump to

Keyboard shortcuts

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