modulepackage
0.0.8
Repository: https://github.com/volatiletech/strmangle.git
Documentation: pkg.go.dev
# Functions
No description provided by the author
No description provided by the author
CamelCase takes a variable name in the format of "var_name" and converts it into a go styled variable name of "varName".
CamelCaseFull is like CamelCase, but trims digits on the leftmost of the string.
ContainsAny returns true if any of the passed in strings are found in the passed in string slice.
GenerateIgnoreTags converts a slice of tag strings into ignore tags that can be passed onto the end of a struct, for example: tags: ["xml", "db"] convert to: xml:"-" db:"-".
GenerateTags converts a slice of tag strings into tags that can be passed onto the end of a struct, for example: tags: ["xml", "db"] convert to: xml:"column_name" db:"column_name".
No description provided by the author
GetBuffer retrieves a buffer from the buffer pool.
Identifier is a base conversion from Base 10 integers to Base 26 integers that are represented by an alphabet from a-z See tests for example outputs.
IdentQuote attempts to quote simple identifiers in SQL statements.
IdentQuoteSlice applies IdentQuote to a slice.
Ignore sets "-" for the tags values, so the fields will be ignored during parsing.
JoinSlices merges two string slices of equal length.
MakeStringMap converts a map[string]string into the format: "key": "value", "key": "value".
ParseEnumName returns the name portion of an enum if it exists
Postgres and MySQL drivers return different values psql: enum.enum_name('values'...) mysql: enum('values'...) In the case of mysql, the name will never return anything.
ParseEnumVals returns the values from an enum string
Postgres and MySQL drivers return different values psql: enum.enum_name('values'...) mysql: enum('values'...).
Placeholders generates the SQL statement placeholders for in queries.
Plural converts singular words to plural words (eg: person to people).
PrefixStringSlice with the given str.
PutBuffer back into the buffer pool.
QuoteCharacter returns a string that allows the quote character to be embedded into a Go string that uses double quotes:.
RemoveDuplicates from a string slice.
ReplaceReservedWords takes a word and replaces it with word_ if it's found in the list of reserved words.
SchemaTable returns a table name with a schema prefixed if using a database that supports real schemas, for example, for Postgres: "schema_name"."table_name", for MS SQL: [schema_name].[table_name], versus simply "table_name" for MySQL (because it does not support real schemas).
SetComplement subtracts the elements in b from a.
SetInclude checks to see if the string is found in the string slice.
SetIntersect will return all elements present in both a and b.
SetMerge will return a merged slice without duplicates.
SetParamNames takes a slice of columns and returns a comma separated list of parameter names for a template statement SET clause.
Singular converts plural words to singular words (eg: people to person).
SortByKeys returns a new ordered slice based on the keys ordering.
StringMap maps a function over a slice of strings.
StringSliceMatch returns true if the length of both slices is the same, and the elements of both slices are the same.
StripWhitespace removes all whitespace from a string.
TitleCase changes a snake-case variable name into a go styled object variable name of "ColumnName".
TitleCaseFull is like TitleCase, but trims digits on the leftmost of the string.
TitleCaseIdentifier splits on dots and then titlecases each fragment.
TrimLeftDigits is for sanitizing the final output of an golang identifier: trimming digits at the start.
WhereClause returns the where clause using start as the $ flag index For example, if start was 2 output would be: "colthing=$2 AND colstuff=$3".
WhereClauseRepeated returns the where clause repeated with OR clause using start as the $ flag index For example, if start was 2 output would be: "(colthing=$2 AND colstuff=$3) OR (colthing=$4 AND colstuff=$5)".
WhereInClause returns the where clause using start as the $ flag index For example, if start was 2 output would be: "col IN ($2,$3)".