将enum存入数据库时保存为string #1773

Open
opened 2020-08-25 04:06:31 +00:00 by cfw · 0 comments

目前enum只能保存为int,请问有这个功能可以自动将enum存为string格式吗?

type Payment struct {
	Status    enum.PaymentStatus `xorm:"varchar(20)"`
}

如上struct,可以保存为.String()吗?

目前enum只能保存为int,请问有这个功能可以自动将enum存为string格式吗? ``` type Payment struct { Status enum.PaymentStatus `xorm:"varchar(20)"` } ``` 如上struct,可以保存为<PaymentStatus>.String()吗?
lunny added the
kind
proposal
label 2021-06-06 05:35:32 +00:00
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: xorm/xorm#1773
No description provided.