Documentation ¶
Index ¶
- Constants
- func CleanAllWhitespaces(s string) string
- func CleanJsonWhitespaces(s string) string
- func GetConfigDir() (string, error)
- func GetMongoType(v interface{}) string
- func GetSortedKeysWithTypes(documents []primitive.M, typeColor string) []string
- func HidePasswordInUri(s string) string
- func IsHexColor(s string) bool
- func IsJsonEmpty(s string) bool
- func LoadConfigFile[T any](defaultConfig *T, configPath string) (*T, error)
- func MergeConfigs(loaded, defaultConfig interface{})
- func ParseDateToBson(s string) (string, error)
- func QuoteUnquotedKeys(s string) string
- func StringifyMongoValueByType(v interface{}) string
- func TrimMultipleSpaces(s string) string
Constants ¶
const ( TypeString = "String" TypeInt32 = "Int32" TypeInt64 = "Int64" TypeDouble = "Double" TypeBool = "Bool" TypeObjectId = "ObjectID" TypeDate = "Date" TypeTimestamp = "Timestamp" TypeArray = "Array" TypeObject = "Object" TypeRegex = "Regex" TypeBinary = "Binary" TypeMinKey = "MinKey" TypeMaxKey = "MaxKey" TypeMixed = "Mixed" TypeNull = "Null" TypeUndefined = "Undefined" )
const (
ConfigDir = "vi-mongo"
)
Variables ¶
This section is empty.
Functions ¶
func CleanAllWhitespaces ¶ added in v0.1.9
CleanAllWhitespaces removes all whitespaces from a string
func CleanJsonWhitespaces ¶
CleanJsonWhitespaces removes new lines and redundant spaces from a JSON string and also removes comma from the end of the string
func GetConfigDir ¶
GetConfigDir returns the path to the config directory
func GetMongoType ¶
func GetMongoType(v interface{}) string
Helper function to determine MongoDB type
func GetSortedKeysWithTypes ¶
func HidePasswordInUri ¶
HidePasswordInUri redacts the password in a connection string
func IsJsonEmpty ¶
IsJsonEmpty checks if a JSON string is empty or only contains whitespace
func LoadConfigFile ¶
LoadConfigFile loads a configuration file, merges it with defaults, and returns the result
func MergeConfigs ¶
func MergeConfigs(loaded, defaultConfig interface{})
MergeConfigs merges the loaded config with the default config
func ParseDateToBson ¶
ParseDateToBson parses a date in a JSON string into a BSON date
func QuoteUnquotedKeys ¶
QuoteUnquotedKeys adds quotes to unquoted keys in a JSON-like string
func StringifyMongoValueByType ¶ added in v0.1.9
func StringifyMongoValueByType(v interface{}) string
StringifyMongoValueByType converts a value to a string
func TrimMultipleSpaces ¶
TrimMultipleSpaces trims multiple spaces into a single space
Types ¶
This section is empty.