column.go 411 B

1234567891011121314151617181920
  1. package orm
  2. // column is a column in a table
  3. type column struct {
  4. field
  5. ref string
  6. }
  7. // GetName returns the name. If relation is given, it
  8. // will return `tbl`.`col` retpr
  9. func (c column) GetName(r ...*relation) string {
  10. if len(r) > 0 {
  11. return "`" + r[0].f.getFieldName() + "`.`" + c.ref + "`"
  12. }
  13. return "`" + c.ref + "`"
  14. }
  15. // columns is the collection of all columns in a table
  16. type columns []column