package dao

import (
	"github.com/astaxie/beego/client/orm"
	"github.com/go-sql-driver/mysql"
)

func IsDuplicateError(err error) bool {
	if mysqlErr, ok := err.(*mysql.MySQLError); ok {
		if mysqlErr.Number == 1062 {
			return true
		}
	}
	return false
}

func IsNoRowsError(err error) bool {
	return err == orm.ErrNoRows
}
