order_answer.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // ==========================================================================
  2. // Code generated by GoFrame CLI tool. DO NOT EDIT.
  3. // ==========================================================================
  4. package internal
  5. import (
  6. "context"
  7. "github.com/gogf/gf/database/gdb"
  8. "github.com/gogf/gf/frame/g"
  9. )
  10. // OrderAnswerDao is the manager for logic model data accessing and custom defined data operations functions management.
  11. type OrderAnswerDao struct {
  12. Table string // Table is the underlying table name of the DAO.
  13. Group string // Group is the database configuration group name of current DAO.
  14. Columns OrderAnswerColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
  15. }
  16. // OrderAnswerColumns defines and stores column names for table order_answer.
  17. type OrderAnswerColumns struct {
  18. TraId string //
  19. OrderId string // 报名信息(order_info)id
  20. AdditionalQuestionId string // task_require_additional_tallent_info表中的id,即问题
  21. QuestionAnswer string // 问题答案,单选或多选为选项的id,问题为输入框时则为文本,为图片上传时则为上传后的图片url
  22. }
  23. // orderAnswerColumns holds the columns for table order_answer.
  24. var orderAnswerColumns = OrderAnswerColumns{
  25. TraId: "tra_id",
  26. OrderId: "order_id",
  27. AdditionalQuestionId: "additional_question_id",
  28. QuestionAnswer: "question_answer",
  29. }
  30. // NewOrderAnswerDao creates and returns a new DAO object for table data access.
  31. func NewOrderAnswerDao() *OrderAnswerDao {
  32. return &OrderAnswerDao{
  33. Group: "default",
  34. Table: "order_answer",
  35. Columns: orderAnswerColumns,
  36. }
  37. }
  38. // DB retrieves and returns the underlying raw database management object of current DAO.
  39. func (dao *OrderAnswerDao) DB() gdb.DB {
  40. return g.DB(dao.Group)
  41. }
  42. // Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
  43. func (dao *OrderAnswerDao) Ctx(ctx context.Context) *gdb.Model {
  44. return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
  45. }
  46. // Transaction wraps the transaction logic using function f.
  47. // It rollbacks the transaction and returns the error from function f if it returns non-nil error.
  48. // It commits the transaction and returns nil if function f returns nil.
  49. //
  50. // Note that, you should not Commit or Rollback the transaction in function f
  51. // as it is automatically handled by this function.
  52. func (dao *OrderAnswerDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
  53. return dao.Ctx(ctx).Transaction(ctx, f)
  54. }