// ==========================================================================
// Code generated by GoFrame CLI tool. DO NOT EDIT.
// ==========================================================================

package internal

import (
	"context"
	"github.com/gogf/gf/database/gdb"
	"github.com/gogf/gf/frame/g"
)

// OrderAnswerDao is the manager for logic model data accessing and custom defined data operations functions management.
type OrderAnswerDao struct {
	Table   string          // Table is the underlying table name of the DAO.
	Group   string          // Group is the database configuration group name of current DAO.
	Columns OrderAnswerColumns // Columns is the short type for Columns, which contains all the column names of Table for convenient usage.
}

// OrderAnswerColumns defines and stores column names for table order_answer.
type OrderAnswerColumns struct {
	TraId                 string //                                                                                          
    OrderId               string // 报名信息(order_info)id                                                                   
    AdditionalQuestionId  string // task_require_additional_tallent_info表中的id，即问题                                     
    QuestionAnswer        string // 问题答案，单选或多选为选项的id，问题为输入框时则为文本，为图片上传时则为上传后的图片url
}

//  orderAnswerColumns holds the columns for table order_answer.
var orderAnswerColumns = OrderAnswerColumns{
	TraId:                "tra_id",                  
            OrderId:              "order_id",                
            AdditionalQuestionId: "additional_question_id",  
            QuestionAnswer:       "question_answer",
}

// NewOrderAnswerDao creates and returns a new DAO object for table data access.
func NewOrderAnswerDao() *OrderAnswerDao {
	return &OrderAnswerDao{
		Group:   "default",
		Table:   "order_answer",
		Columns: orderAnswerColumns,
	}
}

// DB retrieves and returns the underlying raw database management object of current DAO.
func (dao *OrderAnswerDao) DB() gdb.DB {
	return g.DB(dao.Group)
}

// Ctx creates and returns the Model for current DAO, It automatically sets the context for current operation.
func (dao *OrderAnswerDao) Ctx(ctx context.Context) *gdb.Model {
	return dao.DB().Model(dao.Table).Safe().Ctx(ctx)
}

// Transaction wraps the transaction logic using function f.
// It rollbacks the transaction and returns the error from function f if it returns non-nil error.
// It commits the transaction and returns nil if function f returns nil.
//
// Note that, you should not Commit or Rollback the transaction in function f
// as it is automatically handled by this function.
func (dao *OrderAnswerDao) Transaction(ctx context.Context, f func(ctx context.Context, tx *gdb.TX) error) (err error) {
	return dao.Ctx(ctx).Transaction(ctx, f)
}