Add another method of setting table name. #89
Labels
No Label
backport/done
backport/v1
blocked
db
oracle
db
sqlserver
duplicate
feature
cache
frontport/done
frontport/main
invalid
kind
breaking
kind
bug
kind
build
kind
dependencies
kind
docs
kind
driver
kind
enhancement
kind
feature
kind
performance
kind
proposal
kind
question
kind
refactor
kind
testing
need
feedback
need
test
proposal:accepted
RaspBerry Pi
regression
skip-changelog
upstream
wip
wontfix
No Milestone
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: xorm/xorm#89
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
At the moment if your table name is not the same as the class name you got to set it for every single operation e.g.: session.Table("users").Find(&users). Would be nice if you could set it on the struct such as:
type User struct {
Id int64
xorm:"id"
UserName string
xorm:"username"
FullName string
xorm:"full_name"
}
func (this User) TableName() {
return "users"
}
I like the idea of declaring the table once and then using the fields instead of stating table and column names and use Go's type system. It makes it easier to rename columns in the future and make the compiler help you catch references to it.