Skip to content

v0.3.0

Compare
Choose a tag to compare
@sxwebdev sxwebdev released this 11 Apr 17:17
· 10 commits to master since this release
61604b2

NEW

  • Use go ast parser
  • Update go keystone models
  • Bump sqlc version to 1.26.0
  • Update all dependencies
  • Generate column names for table

Generate column names for table

Use new param include_column_names in constants to generate column names for table

constants:
  tables:
    users:
      output_dir: internal/store/repos/repo_users
      include_column_names: true

The output will be like this

type ColumnName string

func (s ColumnName) String() string { return string(s) }

func (s ColumnName) StructName() string {
	v := stringy.New(string(s)).CamelCase()
	v = stringy.New(v).UcFirst()
	return strings.ReplaceAll(v, "Id", "ID")
}

const (
	ColumnNameUsersId                  ColumnName = "id"
	ColumnNameUsersFirstName           ColumnName = "first_name"
	ColumnNameUsersLastName            ColumnName = "last_name"
	ColumnNameUsersCreatedAt           ColumnName = "created_at"
)

func UsersColumnNames() []ColumnName {
	return []ColumnName{
		ColumnNameUsersId,
		ColumnNameUsersFirstName,
		ColumnNameUsersLastName,
		ColumnNameUsersCreatedAt,
	}
}