Documentation
¶
Index ¶
- func ConvertAttrName(name string, convention Convention) string
- func DefaultAttrName(name string) string
- func ResolveAttrName(field reflect.StructField) (string, bool)
- func ResolveAttrNameWithConvention(field reflect.StructField, convention Convention) (string, bool)
- func ToSnakeCase(name string) string
- func ValidateAttrName(name string, convention Convention) error
- type Convention
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertAttrName ¶ added in v1.0.34
func ConvertAttrName(name string, convention Convention) string
ConvertAttrName converts a field name to the appropriate naming convention.
func DefaultAttrName ¶
DefaultAttrName converts a Go struct field name to the preferred camelCase DynamoDB attribute name.
func ResolveAttrName ¶
func ResolveAttrName(field reflect.StructField) (string, bool)
ResolveAttrName determines the DynamoDB attribute name for a field using CamelCase convention. It returns the attribute name and a bool indicating whether the field should be skipped.
func ResolveAttrNameWithConvention ¶ added in v1.0.34
func ResolveAttrNameWithConvention(field reflect.StructField, convention Convention) (string, bool)
ResolveAttrNameWithConvention determines the DynamoDB attribute name for a field using the specified convention. It returns the attribute name and a bool indicating whether the field should be skipped.
func ToSnakeCase ¶ added in v1.0.34
ToSnakeCase converts a Go struct field name to snake_case DynamoDB attribute name. It uses smart acronym handling: "URLValue" → "url_value", "ID" → "id", "UserID" → "user_id".
func ValidateAttrName ¶
func ValidateAttrName(name string, convention Convention) error
ValidateAttrName enforces the naming convention for DynamoDB attribute names. For CamelCase: allows "PK" and "SK" as exceptions, otherwise enforces camelCase pattern. For SnakeCase: enforces snake_case pattern (no special exceptions).
Types ¶
type Convention ¶ added in v1.0.34
type Convention int
Convention represents the naming convention for DynamoDB attribute names.
const ( // CamelCase convention: "firstName", "createdAt", with special handling for "PK" and "SK" CamelCase Convention = 0 // SnakeCase convention: "first_name", "created_at" SnakeCase Convention = 1 )