Orm Model

Structs

None

OrmModel

Represents a Database Model with metadata for ORM transformations.

Fields:

  • TableName (string): The name of the table associated with the model.
  • ModelName (string): The name of the model in the ORM context.
  • Orm (string): The ORM library or framework being used.
  • Columns ([]OrmColumn): A list of columns associated with the model.

Functions

GetModelNameInCase

func (m *OrmModel) GetModelNameInCase(caseToReturn string) string

Returns the ModelName of the OrmModel converted to the specified case format.

Parameters:

  • caseToReturn (string): The desired case format (e.g., camel, pascal, snake, etc.).

Returns:

  • (string): The ModelName converted to the specified case format.

GetModelTableNameInCase

func (m *OrmModel) GetModelTableNameInCase(caseToReturn string) string

Returns the TableName of the OrmModel converted to the specified case format.

Parameters:

  • caseToReturn (string): The desired case format (e.g., camel, pascal, snake, etc.).

Returns:

  • (string): The TableName converted to the specified case format.

GetPrimaryModelColumns

func (m *OrmModel) GetPrimaryModelColumns() []OrmColumn

Returns a slice of OrmColumn objects that are marked as primary keys.

Returns:

  • ([]OrmColumn): A list of primary key columns.

GetModelNamePluralInCase

func (m *OrmModel) GetModelNamePluralInCase(caseToReturn string) string

Returns the pluralized TableName of the OrmModel converted to the specified case format.

Parameters:

  • caseToReturn (string): The desired case format (e.g., camel, pascal, snake, screamingSnake, kebab or screamingKebab.).

Returns:

  • (string): The pluralized TableName converted to the specified case format.