surrealdb / surrealdb.go

SurrealDB SDK for Golang
https://surrealdb.com
Apache License 2.0
231 stars 62 forks source link

Add function to check if error is about duplicate fields on an unique index #73

Closed pof3 closed 1 year ago

pof3 commented 1 year ago

Just as the os module provides users with the os.IsNotExist function to test if the error was generated by trying to open a non existent file, regardless of its name, this commit adds the same functionality to check if the error comes from trying to insert data to a table with an unique index.

P.S. Also, minor typo fixed in a comment.

pof3 commented 1 year ago

Nevermind, didn't add tests and also forgot that the error is composed.