package
0.0.0-20210718062109-496be73d0ac7
Repository: https://github.com/piyuo/libsrv.git
Documentation: pkg.go.dev

# Functions

GetAccountID return current user id from context accountID := GetAccountID(ctx) .
GetIP return ip from current request, return empty if anything wrong ip := GetIP(ctx) .
GetRequest get current request from context request := GetRequest(ctx) .
GetUserAgent return user agent from current request, return empty if anything wrong ua := GetUserAgent(ctx) //"Mozilla/5.0 (iPhone; CPU iPhone OS 7_0 like Mac OS X) AppleWebKit/546.10 (KHTML, like Gecko) Version/6.0 Mobile/7E18WD Safari/8536.25" .
GetUserAgentID return short id from user agent.
GetUserAgentString return short string with version info from user agent ua := GetUserAgentString(ctx) // "iPhone,iOS 7.0,Safari 6.0" .
GetUserID return current user id from context userID := GetUserID(ctx) .
SetAccountID set AccountID into ctx, this may used in log and data package ctx = SetAccountID(ctx,"account id") .
SetRequest set request into ctx, this may used in log and data package ctx = SetRequest(ctx,request) .
SetUserID set UserID into ctx, this may used in log and data package ctx = SetUserID(ctx,"user id") .

# Constants

KeyContextAccountID is context key name for account id .
KeyContextLocale used in i18n to mock locale .
KeyContextRequest is context key name for request .
KeyContextUserID is context key name for user id .
MockIP provide mock ip 127.0.0.1 on GetIP() .

# Variables

No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

KeyContext define key used in ctx .
Mock define key test flag .