Util Package Methods and Functions
ParseTime
ParseTime parses time from an interface{} value.
Parameters:
raw: Time to parse.
Returns:
time.Time: The parsed Time.
error: Any errors from the function.
PrepareQuery
PrepareQuery converts named parameters in the query to positional placeholders and returns the transformed query along with an args slice.
Parameters:
namedQuery: Query to prepare.
params: Parameters that will be inserted into the namedQuery.
Returns:
string: Transformed query.
[]interface{}: Arguments slice.
error: Any errors from the function.
FormatQueryWithBindings
FormatQueryWithBindings converts bindings into a query.
Parameters:
query: The query to be formated.
bindings: A map of bindings to insert into the query.
Returns:
string: The formatted query.
GenerateConstraintCommand
GenerateConstraintCommand generates a constraint based on the parameters passed in.
Parameters:
Get inserted in
CREATE CONSTRAINT %s IF NOT EXISTS FOR (n:%s) REQUIRE n.%s IS %s;"
Returns:
command.CypherCommand: A new CypherCommand.
SerializeIfNeeded
SerializeIfNeeded serializes certain structures to JSON strings if needed.
DeserializeIfNeeded
DeserializeIfNeeded attempts to deserialize a JSON string into a map or slice if it can.
AssertStringSlice
AssertStringSlice ensures an interface{} is a []string.
ConvertInterfaceSliceToStringSlice
ConvertInterfaceSliceToStringSlice converts []interface{} to []string.