https://github.com/qinxin0720/fuzzysearch
golang database orm fuzzysearch
https://github.com/qinxin0720/fuzzysearch
Last synced: 3 months ago
JSON representation
golang database orm fuzzysearch
- Host: GitHub
- URL: https://github.com/qinxin0720/fuzzysearch
- Owner: qinxin0720
- License: mit
- Created: 2021-08-27T03:27:48.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-23T14:38:37.000Z (about 3 years ago)
- Last Synced: 2025-01-19T22:39:54.097Z (5 months ago)
- Language: Go
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang orm fuzzysearch
## install
```sh
go get -u -v github.com/qinxin0720/fuzzysearch
```## type
```go
type Student struct {
ID string `gorm:"column:id" xorm:"'id'"`
Name string `gorm:"column:name" xorm:"'name'"`
Description string `gorm:"column:description" xorm:"'description'"`
}
```## for xorm
```go
import fuzzysearch "github.com/qinxin0720/fuzzysearch/xorm"list := make([]Student, 0)
cond, values, err := fuzzySearch.FuzzySearch("alice", "name", "description")
if err != nil {
return err
}db.Where(cond, values...).
Find(&list)
```## for gorm
```go
import fuzzysearch "github.com/qinxin0720/fuzzysearch/gorm"list := make([]Student, 0)
db.Scopes(fuzzysearch.FuzzySearch("alice", "name", "description")).
Find(&list)
```