// Package gormcol provides type-safe GORM column descriptors.
//
// This package enables defining struct-like variables that map Go field names
// to database column names, allowing type-safe queries in GORM.
//
// Example usage:
//
//	var PsAccessCols = struct {
//	    IDProfile           gormcol.Field
//	    IDAuthorizationRole gormcol.Field
//	}{
//	    IDProfile:           gormcol.Field{}.Set((&PsAccess{}).TableName(), "id_profile"),
//	    IDAuthorizationRole: gormcol.Field{}.Set((&PsAccess{}).TableName(), "id_authorization_role"),
//	}
package gormcol

// Field represents a GORM column descriptor.
// Table should be set using the model's TableName() function for type safety.
type Field struct {
	table  string // Database table name (use model's TableName())
	column string // Database column name
}

func (f Field) TabCol() string {
	return f.table + "." + f.column
}

func (f Field) Col() string {
	return f.column
}

func (f Field) Tab() string {
	return f.table
}

func (f Field) Set(tab, field string) Field {
	return Field{
		table:  tab,
		column: field,
	}
}
