Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use gorm.io #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# Validations

Validations provides a means to [*validate*](https://en.wikipedia.org/wiki/Data_validation) [GORM](https://github.com/jinzhu/gorm) models when creating and updating them.
Validations provides a means to [*validate*](https://en.wikipedia.org/wiki/Data_validation) [GORM](https://gorm.io/gorm) models when creating and updating them.

### Register GORM Callbacks

Validations uses [GORM](https://github.com/jinzhu/gorm) callbacks to handle *validations*, so you will need to register callbacks first:
Validations uses [GORM](https://gorm.io/gorm) callbacks to handle *validations*, so you will need to register callbacks first:

```go
import (
"github.com/jinzhu/gorm"
"gorm.io/gorm"
"github.com/qor/validations"
)

Expand Down
2 changes: 1 addition & 1 deletion callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"

"github.com/asaskevich/govalidator"
"github.com/jinzhu/gorm"
"gorm.io/gorm"
)

var skipValidations = "validations:skip_validations"
Expand Down
2 changes: 1 addition & 1 deletion validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import (
"testing"

"github.com/asaskevich/govalidator"
"github.com/jinzhu/gorm"
_ "github.com/mattn/go-sqlite3"
"github.com/qor/qor/test/utils"
"github.com/qor/validations"
"gorm.io/gorm"
)

var db *gorm.DB
Expand Down
2 changes: 1 addition & 1 deletion validations.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package validations
import (
"fmt"

"github.com/jinzhu/gorm"
"gorm.io/gorm"
)

// NewError generate a new error for a model's field
Expand Down