Documentation ¶
Index ¶
- Variables
- func AllIn(in, all []string) bool
- func BsonQuote(s string) string
- func BsonQuoteMap(m *map[string]interface{}) map[string]interface{}
- func BsonUnquote(s string) string
- func BsonUnquoteMap(m *map[string]interface{}) map[string]interface{}
- func CheckPasswordHash(password, hash string, method Method) bool
- func CreateAccountToken(acc *authmodels.Account, scopes []string) (*authmodels.TokenPayload, error)
- func CreateAuthenticityToken() (string, error)
- func Fetch(ctx context.Context, method, url string, content []byte, rp interface{}, ...) ([]byte, error)
- func FilterStrings(arr []string, cond func(string) bool) []string
- func FlatMap(i interface{}, prefix string) map[string]string
- func GetEnv(key, defaultValue string) string
- func GetFormat(c string) string
- func GetJWTConfig() middleware.JWTConfig
- func GetMongoFieldsFromQuery(querystring url.Values) bson.M
- func GetMongoPaginationFromQuery(querystring url.Values) bson.M
- func GetMongoQueryFromQuery(querystring url.Values) bson.M
- func GetMongoSortingFromQuery(querystring url.Values) bson.M
- func GetPaginationLink(u url.URL, total int64, last, first helpermodels.Datable) helpermodels.Pagination
- func HashPassword(password string, method Method) (string, error)
- func IsNotEmptyString(value string) bool
- func MergeMaps(left, right map[string]interface{}) map[string]interface{}
- func NotImplemented(c echo.Context) error
- func ParseDuration(str string, defaultDuration time.Duration) time.Duration
- func ParseDurationToString(duration time.Duration) string
- func ParseInt64(value string) int64
- func SetMongoPagination(q, s, pa map[string]interface{}, queryOptions *options.FindOptions)
- func SetupEnvDefaults()
- func ValidateAuthenticityToken(tokenString string) error
- type ApiSearchPagination
- type EnvDefaults
- type JwtRsaKeys
- type Method
- type RestHTTPError
Constants ¶
This section is empty.
Variables ¶
var ( CryptoMethods = &crytoMethods{ BCrypt: BCryptMethod, SCrypt: SCryptMethod, } )
CryptoMethods kind a enum for cryptography methods supported
var DefaultPageSize int = 100
DefaultPageSize default page size
Functions ¶
func BsonQuoteMap ¶
BsonQuoteMap create a new map of quotes with escaped indexes
func BsonUnquoteMap ¶
BsonUnquoteMap create a new map of quotes with unescaped indexes
func CheckPasswordHash ¶
CheckPasswordHash validate password agains a given hash
func CreateAccountToken ¶
func CreateAccountToken(acc *authmodels.Account, scopes []string) (*authmodels.TokenPayload, error)
CreateAccountToken create account token
func CreateAuthenticityToken ¶
CreateAuthenticityToken create authenticity token for forms
func Fetch ¶
func Fetch(ctx context.Context, method, url string, content []byte, rp interface{}, headers map[string]string, queries map[string]string) ([]byte, error)
Fetch do an http request
func FilterStrings ¶
FilterStrings filter and slice of strings
func GetMongoFieldsFromQuery ¶
GetMongoFieldsFromQuery get mongo fields from query
func GetMongoPaginationFromQuery ¶
GetMongoPaginationFromQuery get mongo pagination from query
func GetMongoQueryFromQuery ¶
GetMongoQueryFromQuery get mongo query from url query
func GetMongoSortingFromQuery ¶
GetMongoSortingFromQuery get mongo sorting from query
func GetPaginationLink ¶
func GetPaginationLink(u url.URL, total int64, last, first helpermodels.Datable) helpermodels.Pagination
GetPaginationLink get pagination link
func HashPassword ¶
HashPassword create a hashed version of a string
func IsNotEmptyString ¶
IsNotEmptyString check if an string is not empty
func MergeMaps ¶
MergeMaps Given two maps, recursively merge right into left, NEVER replacing any key that already exists in left
func NotImplemented ¶
func NotImplemented(c echo.Context) error
NotImplemented rest handler not implemented
func ParseDuration ¶
ParseDuration parse a duration string
func ParseDurationToString ¶
ParseDurationToString parse a duration string
func SetMongoPagination ¶
func SetMongoPagination(q, s, pa map[string]interface{}, queryOptions *options.FindOptions)
SetMongoPagination set pagination
func ValidateAuthenticityToken ¶
ValidateAuthenticityToken validate authenticity token for forms
Types ¶
type ApiSearchPagination ¶
type EnvDefaults ¶
type EnvDefaults struct { // ServerHost api server host ServerHost string // ServerPort api server port ServerPort string // HostURL api host URL HostURL string // SessionSecret secret key for session cookie SessionSecret string // JWTTimeoutMinutes JWT timeout JWTTimeoutMinutes string // JWTAuthSecret JWT timeout JWTAuthSecret *rsa.PrivateKey // JWTSigningSecret secret word to sign jwt tokens JWTSigningSecret string // AuthenticityTokenTTLMinutes authenticity token time to live in minutes AuthenticityTokenTTLMinutes string // ScryptSecret secret key for scrypt hash of passwords ScryptSecret string // CronConfig cron initial configuration CronConfig string // FluentHost fluentd host FluentHost string // FluentPort fluentd port FluentPort string // ElasticURL elastic search url ElasticURL string // ElasticUsername elastic search server username ElasticUsername string // ElasticPassword elastic search server password ElasticPassword string // ElasticBearer elastic search server token ElasticBearer string // CollectionPrefix database collection prefix to all collections CollectionPrefix string OpaClientUrl string OpaAppName string SpiceDBURL string SpiceDBToken string SpiceDBInsecure string }
EnvDefaults : EnvDefaults Structure to hold Env default Variable values
var Env EnvDefaults
Env : Env variable to hold Env default Variable values
type JwtRsaKeys ¶
type JwtRsaKeys struct { PrivateKey *rsa.PrivateKey PublicKey *rsa.PublicKey }
JwtRsaKeys Public and Private keys for Jwt
type RestHTTPError ¶
type RestHTTPError struct { Code int `json:"-"` Message interface{} `json:"message"` Internal error `json:"-"` // Stores the error returned by an external dependency }
RestHTTPError rest http