Esempio n. 1
0
func PrimaryKey(exec gomodel.Executor) string {
	return exec.Driver().PrimaryKey()
}
Esempio n. 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)
}
Esempio n. 3
0
func DuplicatePrimaryKeyError(exec gomodel.Executor, err error, newErr error) error {
	pk := exec.Driver().PrimaryKey()
	return parseKeyError(err, pk, newErr, exec.Driver().DuplicateKey)
}
Esempio n. 4
0
func ForeignKeyError(exec gomodel.Executor, err error, key string, newErr error) error {
	fk := exec.Driver().ForeignKey
	return parseKeyError(err, key, newErr, fk)
}
Esempio n. 5
0
func ForeignKeyFunc(exec gomodel.Executor, err error, keyfunc func(key string) error) error {
	fk := exec.Driver().ForeignKey
	return parseKeyFunc(err, keyfunc, fk)
}
Esempio n. 6
0
func DuplicateKeyError(exec gomodel.Executor, err error, key string, newErr error) error {
	dk := exec.Driver().DuplicateKey
	return parseKeyError(err, key, newErr, dk)
}
Esempio n. 7
0
func DuplicateKeyFunc(exec gomodel.Executor, err error, keyfunc func(key string) error) error {
	dk := exec.Driver().DuplicateKey
	return parseKeyFunc(err, keyfunc, dk)
}