Example #1
0
func PrimaryKey(exec gomodel.Executor) string {
	return exec.Driver().PrimaryKey()
}
Example #2
0
func QueryOneResultById(exec gomodel.Executor, sqlid uint64, ptr interface{}, args ...interface{}) error {
	sc := exec.QueryById(sqlid, args...)
	defer sc.Close()
	return sc.One(ptr)
}
Example #3
0
func DuplicatePrimaryKeyError(exec gomodel.Executor, err error, newErr error) error {
	pk := exec.Driver().PrimaryKey()
	return parseKeyError(err, pk, newErr, exec.Driver().DuplicateKey)
}
Example #4
0
func ForeignKeyError(exec gomodel.Executor, err error, key string, newErr error) error {
	fk := exec.Driver().ForeignKey
	return parseKeyError(err, key, newErr, fk)
}
Example #5
0
func ForeignKeyFunc(exec gomodel.Executor, err error, keyfunc func(key string) error) error {
	fk := exec.Driver().ForeignKey
	return parseKeyFunc(err, keyfunc, fk)
}
Example #6
0
func DuplicateKeyError(exec gomodel.Executor, err error, key string, newErr error) error {
	dk := exec.Driver().DuplicateKey
	return parseKeyError(err, key, newErr, dk)
}
Example #7
0
func DuplicateKeyFunc(exec gomodel.Executor, err error, keyfunc func(key string) error) error {
	dk := exec.Driver().DuplicateKey
	return parseKeyFunc(err, keyfunc, dk)
}