package gormcol // Field represents a GORM column descriptor with table context. // Define package-level variables to get type-safe column references: // // var PsAccess = struct { // IDProfile gormcol.Field // IDAuthorizationRole gormcol.Field // }{ // IDProfile: gormcol.Field{Table: "ps_access", Column: "id_profile"}, // IDAuthorizationRole: gormcol.Field{Table: "ps_access", Column: "id_authorization_role"}, // } type Field struct { Table string Column string } // Column returns the column name from a Field descriptor. // // gormcol.Column(dbmodel.PsAccess.IDAuthorizationRole) // "id_authorization_role" func Column(f Field) string { return f.Column } // ColumnOnTable returns "table.column" from a Field descriptor. // // gormcol.ColumnOnTable(dbmodel.PsAccess.IDAuthorizationRole) // "ps_access.id_authorization_role" func ColumnOnTable(f Field) string { return f.Table + "." + f.Column } // TableField returns the table name from a Field descriptor. func TableField(f Field) string { return f.Table }