Orm Column
Structs
None
OrmColumn
Represents a database column with metadata for ORM transformations. It includes details such as column name, data types, property name, and constraints.
Fields:
- ColumnName (string): Name of the column in the database.
- OrmType (string): The ORM type associated with this column.
- DatabaseType (string): The database native type for this column.
- PropertyName (string): The corresponding property name in the ORM model.
- IsPrimaryKey (bool): Indicates whether the column is a primary key.
- IsNullable (bool): Specifies whether the column can have
NULL
values. - IsAutoIncrement (bool): Indicates if the column is auto-incrementing.
Functions
GetPropertyNameInCase
func (c *OrmColumn) GetPropertyNameInCase(caseToReturn string) string
Returns the PropertyName
of the OrmColumn
converted to the specified case format.
Parameters:
- caseToReturn (string): The desired case style (e.g., “pascal”, “camel”, “kebab”, or “snake”).
Returns:
- (string): The
PropertyName
formatted in the specified case. ˚—
GetColumnNameInCase
func (c *OrmColumn) GetColumnNameInCase(caseToReturn string) string
Returns the ColumnName
formatted in the specified case style (e.g., camel, snake, kebab, pascal).
Parameters:
- caseToReturn (string): The desired case style (e.g., “pascal”, “camel”, “kebab”, or “snake”).
Returns:
- (string): The
ColumnName
formatted in the specified case.
getCaseValue
func getCaseValue(caseToReturn, value string) string
Transforms a string to a specified case format such as pascal, camel, kebab, or snake based on the input.
Parameters:
- caseToReturn (string): The desired case style (e.g., “pascal”, “camel”, “kebab”, or “snake”).
- value (string): The input string to be transformed.
Returns:
- (string): The input string formatted to the specified case.
Functions
GetPropertyNameInCase
func (c *OrmColumn) GetPropertyNameInCase(caseToReturn string) string
Returns the PropertyName
of the OrmColumn
converted to the specified case format.
Parameters:
- caseToReturn (string): The desired case style (e.g., “pascal”, “camel”, “kebab”, or “snake”).
Returns:
- (string): The
PropertyName
formatted in the specified case.
GetColumnNameInCase
func (c *OrmColumn) GetColumnNameInCase(caseToReturn string) string
Returns the ColumnName
formatted in the specified case style (e.g., camel, snake, kebab, pascal).
Parameters:
- caseToReturn (string): The desired case style (e.g., “pascal”, “camel”, “kebab”, “screamingKebab”, “snake” or “screamingSnake”).
Returns:
- (string): The
ColumnName
formatted in the specified case.