// =================================================================================
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
// =================================================================================

package dao

import (
	"context"
	"github.com/gogf/gf/v2/errors/gerror"
	"hotgo/internal/consts"
	"hotgo/internal/dao/internal"
)

// internalSysCronGroupDao is internal type for wrapping internal DAO implements.
type internalSysCronGroupDao = *internal.SysCronGroupDao

// sysCronGroupDao is the data access object for table hg_sys_cron_group.
// You can define custom methods on it to extend its functionality as you wish.
type sysCronGroupDao struct {
	internalSysCronGroupDao
}

var (
	// SysCronGroup is globally public accessible object for table hg_sys_cron_group operations.
	SysCronGroup = sysCronGroupDao{
		internal.NewSysCronGroupDao(),
	}
)

// GetName 获取分组名称
func (dao *sysCronGroupDao) GetName(ctx context.Context, id int64) (name string, err error) {
	m := dao.Ctx(ctx).Fields("name").Where("id", id)
	list, err := m.Value()
	if err != nil {
		err = gerror.Wrap(err, consts.ErrorORM)
		return name, err
	}

	return list.String(), nil
}
