naming

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2026 License: Apache-2.0 Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

func DefaultAttrName(name string) string

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

func ToSnakeCase(name string) string

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
)

Jump to

Keyboard shortcuts

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