Documentation
¶
Index ¶
- Constants
- func FloatInSlice(niddle float64, haystack []float64) bool
- func IsGCType(key string) bool
- func IsMBType(key string) bool
- func SanitiseURL(url string) (string, error)
- func StringInMapKeys(niddle string, haystack map[string]string) bool
- func StringInSlice(niddle string, haystack []string) bool
- func Uint64InSlice(niddle uint64, haystack []uint64) bool
- type Entry
- type FieldLogger
- type Level
- type Logger
Examples ¶
Constants ¶
View Source
const ( InfoLevel = logrus.InfoLevel WarnLevel = logrus.WarnLevel DebugLevel = logrus.DebugLevel ErrorLevel = logrus.ErrorLevel )
Variables ¶
This section is empty.
Functions ¶
func FloatInSlice ¶
FloatInSlice returns true if niddle is in the haystack
func SanitiseURL ¶
SanitiseURL prepends a protocol to the url if not defined, and checks if it's a valid url.
Example ¶
This example shows how to sanitise a URL.
package main import ( "fmt" "github.com/arsham/expvastic/internal" ) func main() { res, err := internal.SanitiseURL("http localhost") fmt.Printf("Error: %v\n", err) fmt.Printf("Result: <%s>\n", res) res, err = internal.SanitiseURL("127.0.0.1") fmt.Printf("Error: %v\n", err) fmt.Printf("Result: <%s>\n", res) res, _ = internal.SanitiseURL("https://localhost.localdomain") fmt.Printf("Result: <%s>\n", res) }
Output: Error: invalid url: http localhost Result: <> Error: <nil> Result: <http://127.0.0.1> Result: <https://localhost.localdomain>
func StringInMapKeys ¶
StringInMapKeys returns true if niddle is in the haystack's keys
func StringInSlice ¶
StringInSlice returns true if niddle is in the haystack
func Uint64InSlice ¶
Uint64InSlice returns true if niddle is in the haystack
Types ¶
type FieldLogger ¶
type FieldLogger logrus.FieldLogger
type Logger ¶
func DiscardLogger ¶
func DiscardLogger() *Logger
DiscardLogger returns a dummy logger. This is useful for tests when you don't want to actually write to the Stdout.
func StandardLogger ¶
func StandardLogger() *Logger
Directories
¶
Path | Synopsis |
---|---|
Package datatype contains necessary logic to sanitise a JSON object coming from a reader.
|
Package datatype contains necessary logic to sanitise a JSON object coming from a reader. |
Package token contains necessary logic for passing messages.
|
Package token contains necessary logic for passing messages. |
Click to show internal directories.
Click to hide internal directories.