Documentation
¶
Index ¶
- Constants
- Variables
- type Dummy
- type EnvKey
- type Message
- type QVals
- type Vars
- func (v *Vars) AppendQuery(key string, values ...string)
- func (v *Vars) AppendQueryMap(params map[string][]string)
- func (v *Vars) CanonicalQuerySHA256(exclude ...string) string
- func (v *Vars) CanonicalRawQuery(exclude ...string) string
- func (v *Vars) GetPath(key string) (string, error)
- func (v *Vars) GetQuery(key string, errOnEmpty bool) (QVals, error)
- func (v *Vars) GetQueryFirst(key string, errOnEmpty bool) (string, error)
- func (v *Vars) ReplaceQuery(key string, values ...string)
- func (v *Vars) ReplaceQueryMap(params map[string][]string)
- type VarsKey
Constants ¶
const ( MimeJSON = "application/json" MimeOctetStream = "application/octet-stream" MimeMultipart = "multipart/form-data" MimeHTML = "text/html; charset=utf-8" EncodingGzip = "gzip" MimePrefixImage = "image" MimePrefixVideo = "video" MimePrefixAudio = "audio" MimePrefixOther = "other" )
Mime types.
const ( DefaultTimeout = 2 * time.Minute DefaultTimeoutMedium = 15 * time.Minute DefaultTimeoutLong = time.Hour DefaultTimeoutShort = 1 * time.Minute DefaultIdempotencyTTL = 5 * time.Minute )
Timeouts.
const ( AccessControlAllowMethodsKey = "Access-Control-Allow-Methods" AccessControlAllowHeadersKey = "Access-Control-Allow-Headers" AccessControlAllowOriginKey = "Access-Control-Allow-Origin" AccessControlRequestHeaders = "Access-Control-Request-Headers" Origin = "Origin" CFConnectingIPKey = "CF-Connecting-IP" AllowedOriginsKey = "ALLOWED_ORIGINS" SubpathKey = "subpath" AllowKey = "Allow" HTTPSScheme = "https" HTTPScheme = "http" )
Variables ¶
var ( HeaderAuthorization = http.CanonicalHeaderKey("authorization") HeaderContentType = http.CanonicalHeaderKey("content-type") HeaderContentLength = http.CanonicalHeaderKey("content-length") HeaderContentEncoding = http.CanonicalHeaderKey("content-encoding") HeaderContentDisposition = http.CanonicalHeaderKey("content-disposition") HeaderAcceptEncoding = http.CanonicalHeaderKey("accept-encoding") HeaderXForwardedProto = http.CanonicalHeaderKey("x-forwarded-proto") HeaderXForwardedFor = http.CanonicalHeaderKey("x-forwarded-for") HeaderUserAgent = http.CanonicalHeaderKey("user-agent") HeaderXRealIP = http.CanonicalHeaderKey("x-real-ip") HeaderXTwilioSignature = http.CanonicalHeaderKey("x-twilio-signature") HeaderStripeSignature = http.CanonicalHeaderKey("stripe-signature") )
Headers (Canonicalized for Proper Casing).
var ( PrefixBearer = http.CanonicalHeaderKey("bearer") PrefixMod = http.CanonicalHeaderKey("mod") )
Authentication prefixes.
var ( DummyURL = dummyURL("url") DummyAPIKey = dummy("api-key") DummyStr = dummy("dummy") DummyBytes = dummyBytes(DummyStr) DummyJSON = dummyBytes(`{}`) DummyCredentialsJSON = dummyBytes(`{"type":"service_account","client_email":"noop@noop.invalid","private_key":"-----BEGIN PRIVATE KEY-----\nnoop\n-----END PRIVATE KEY-----\n"}`) )
var ( EnvKeyAddress = envKey("address") EnvKeyProject = envKey("project") EnvKeyEnvironment = envKey("environment") EnvKeyMongoCluster = envKey("mongo_cluster") EnvKeyMongoConnStr = envKey("mongo_conn_str") EnvKeyRedisHost = envKey("redis_host") EnvKeyRedisPort = envKey("redis_port") EnvKeyMongoConnStrDev = envKey("mongo_conn_str_dev") EnvKeyMongoConnStrStaging = envKey("mongo_conn_str_staging") EnvKeyMongoConnStrProd = envKey("mongo_conn_str_prod") EnvKeyMongoClusterDev = envKey("mongo_cluster_dev") EnvKeyMongoClusterStaging = envKey("mongo_cluster_staging") EnvKeyMongoClusterProd = envKey("mongo_cluster_prod") EnvKeyRedisHostDev = envKey("redis_host_dev") EnvKeyRedisHostStaging = envKey("redis_host_staging") EnvKeyRedisHostProd = envKey("redis_host_prod") EnvKeyRedisPortDev = envKey("redis_port_dev") EnvKeyRedisPortStaging = envKey("redis_port_staging") EnvKeyRedisPortProd = envKey("redis_port_prod") )
var ( MsgAuthentication = msg("authentication successful") MsgUpsertOne = msg("record upserted successfully") MsgInsertOne = msg("record created successfully") MsgFindOne = msg("record retrieved successfully") MsgFindMany = msg("records retrieved successfully") MsgReplaceOne = msg("record updated successfully") MsgDeleteOne = msg("record deleted successfully") MsgDeleteMany = msg("records deleted successfully") MsgSearchMany = msg("records found successfully") MsgPull = msg("pull operation successful") MsgNotFound = msg("not found") )
var IPHeaders = []string{HeaderXForwardedFor, HeaderXRealIP, CFConnectingIPKey}
Functions ¶
This section is empty.
Types ¶
type Vars ¶ added in v0.1.10
Vars holds extracted path and query parameters.
func (*Vars) AppendQuery ¶ added in v0.1.451
AppendQuery adds values to an existing query param without replacing it. WARN: appends values; understand the implications in a loop — can cause unintended accumulation.
func (*Vars) AppendQueryMap ¶ added in v0.1.453
AppendQueryMap appends all values from the provided map into the Vars query map without overwriting existing values. WARN: appends values; understand the implications in a loop — can cause unintended accumulation.
func (*Vars) CanonicalQuerySHA256 ¶ added in v0.1.660
CanonicalQuerySHA256 returns a hex digest of CanonicalRawQuery.
func (*Vars) CanonicalRawQuery ¶ added in v0.1.660
CanonicalRawQuery returns a stable query string built from v.Query: - keys sorted lexicographically - values for each key sorted - url-escaped key/value pairs If exclude contains keys, they are omitted.
func (*Vars) GetPath ¶ added in v0.1.32
GetPath returns the value of a path param or an error if not found or empty.
func (*Vars) GetQueryFirst ¶ added in v0.1.32
GetQueryFirst returns the first value of a query param.
func (*Vars) ReplaceQuery ¶ added in v0.1.474
ReplaceQuery sets the query key to the given values, replacing any existing ones.
func (*Vars) ReplaceQueryMap ¶ added in v0.1.475
ReplaceQueryMap sets the query key to the given values, replacing any existing ones.