Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CamelCase ¶
CamelCase converts a snake_case identifier into its JSON field form.
Acronyms are deliberately NOT kept in their Go spelling here: the wire name for tenant_id is tenantId and for base_url it is baseUrl, which is what the framework's own models carry everywhere. Deriving the JSON name by lowercasing the leading run of the Go identifier would instead produce tenantID and baseURL — a different wire contract from the one every existing client is written against. The Go field name and the JSON name follow different conventions, so this does not go through PascalCase.
func EntityFromTable ¶
EntityFromTable derives the entity's snake_case name from a table name, dropping the module's own prefix when the table carries one: md_holiday in module md is the holiday entity, while sys_user in module md keeps its name because the prefix names a different module.
func PascalCase ¶
PascalCase converts a snake_case identifier into its Go exported form, capitalizing recognized acronyms.
Two consecutive acronyms deliberately do not both stay capitalized: only the first keeps its uppercase form and the rest are Pascal-cased, so json_api becomes JSONApi rather than JSONAPI. That is the repository's identifier convention, and it also keeps most names reversible under bun's underscore rule, which only inserts a separator next to a lowercase letter.
It is NOT reversible in general, and callers must not assume it is: api_v1 becomes APIV1, which underscores back to apiv1, because the boundary between an acronym and a following word with no lowercase second rune leaves no trace. A caller that depends on the mapping must verify it with SnakeCase and state the original name explicitly when it does not hold.
func SnakeCase ¶
SnakeCase converts a Go identifier into the snake_case form bun derives column and table names with. It mirrors bun's internal.Underscore: a separator goes in only before an uppercase letter that neighbors a lowercase one, so digits are never split off the word they belong to (Sha256Sum stays sha256_sum).
func TableAlias ¶
TableAlias derives a table's query alias from the initials of its words, which is the convention the framework's models follow (md_allowance_item is aliased mai). A single-word table keeps its first two letters so the alias stays distinguishable from a column reference.
Types ¶
This section is empty.