naming

package
v0.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package naming 提供数据库命名(下划线/中划线)与 Java 命名(驼峰/中划线)之间的转换。 对应 Java 版 BaseCodeApplication 里的 toCamelCase/toUpperCamelCase/toKebabCase/capitalize。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Camel

func Camel(s string) string

Camel 把 user_name / user-name 转成小驼峰 userName。

func Capitalize

func Capitalize(s string) string

Capitalize 仅把首字符大写,其余字符不做任何大小写转换(区别于 UpperCamel 会整体规整)。 用于由小驼峰字段名拼 getter,如 userName -> UserName。

func Kebab

func Kebab(s string) string

Kebab 把大驼峰 UserRole 转成中划线 user-role。 契约:仅接受大驼峰输入(与 Java toKebabCase 一致);下划线/中划线不会被处理, 调用方应传入 UpperCamel 结果(如 naming.Kebab(naming.UpperCamel(name)))。

func UpperCamel

func UpperCamel(s string) string

UpperCamel 把 user_name 转成大驼峰 UserName。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL