added readme, license, and minimised active dependencies
This commit is contained in:
parent
64b8b6e130
commit
852a57d9b3
9
LICENSE
Executable file → Normal file
9
LICENSE
Executable file → Normal file
@ -0,0 +1,9 @@
|
||||
Copyright 2020 Colin Henry
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
17
README.md
Executable file → Normal file
17
README.md
Executable file → Normal file
@ -0,0 +1,17 @@
|
||||
# x
|
||||
|
||||
A mix of useful packages, some are works in progress.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
go get github.com/jchenry/x
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
PRs accepted.
|
||||
|
||||
## License
|
||||
|
||||
MIT © Colin Henry
|
16
go.mod
16
go.mod
@ -3,23 +3,7 @@ module github.com/jchenry/x
|
||||
go 1.13
|
||||
|
||||
require (
|
||||
fyne.io/fyne v1.3.0
|
||||
github.com/PuloV/ics-golang v0.0.0-20190808201353-a3394d3bcade
|
||||
github.com/channelmeter/iso8601duration v0.0.0-20150204201828-8da3af7a2a61 // indirect
|
||||
github.com/codegangsta/negroni v1.0.0
|
||||
github.com/coreos/go-oidc v2.1.0+incompatible
|
||||
github.com/gorilla/sessions v1.2.0
|
||||
github.com/jchenry/jchenry v0.0.0-20200615172632-cb0bc37e6b16
|
||||
github.com/julienschmidt/httprouter v1.2.0
|
||||
github.com/pquerna/cachecontrol v0.0.0-20180517163645-1555304b9b35 // indirect
|
||||
github.com/rsc/rsc v0.0.0-20180427141835-fc6202590229
|
||||
github.com/russross/blackfriday/v2 v2.0.1
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
|
||||
github.com/stripe/stripe-go v63.4.0+incompatible
|
||||
golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e
|
||||
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
|
||||
gopkg.in/auth0.v1 v1.2.7
|
||||
gopkg.in/square/go-jose.v2 v2.3.1 // indirect
|
||||
rsc.io/dbstore v0.1.1
|
||||
rsc.io/rsc v0.0.0-20180427141835-fc6202590229 // indirect
|
||||
)
|
||||
|
@ -1,42 +1,42 @@
|
||||
package crud
|
||||
|
||||
import "github.com/jchenry/jchenry/pkg/db"
|
||||
// import "github.com/jchenry/jchenry/pkg/db"
|
||||
|
||||
type Service interface {
|
||||
// Find returns a pointer to an array of the results found based on params
|
||||
// or an error
|
||||
Find(entityArrPtr interface{}, params map[string]interface{}) (err error)
|
||||
// Create returns the identifier for the newly accepted entity, or error
|
||||
Create(entityPtr interface{}) (err error)
|
||||
// Update returns the id of the newly updated entity, or error
|
||||
Update(entityPtr interface{}) (err error)
|
||||
// Delete returns whether the entity, specified by id, was successfully deleted
|
||||
// or error
|
||||
Delete(entityPtr interface{}) error
|
||||
}
|
||||
// type Service interface {
|
||||
// // Find returns a pointer to an array of the results found based on params
|
||||
// // or an error
|
||||
// Find(entityArrPtr interface{}, params map[string]interface{}) (err error)
|
||||
// // Create returns the identifier for the newly accepted entity, or error
|
||||
// Create(entityPtr interface{}) (err error)
|
||||
// // Update returns the id of the newly updated entity, or error
|
||||
// Update(entityPtr interface{}) (err error)
|
||||
// // Delete returns whether the entity, specified by id, was successfully deleted
|
||||
// // or error
|
||||
// Delete(entityPtr interface{}) error
|
||||
// }
|
||||
|
||||
type Storage struct {
|
||||
Actor db.Actor
|
||||
FindOp func(entityArrPtr interface{}, params map[string]interface{}) db.Func
|
||||
CreateOp func(entityPtr interface{}) db.Func
|
||||
UpdateOp func(entityPtr interface{}) db.Func
|
||||
DeleteOp func(entityPtr interface{}) db.Func
|
||||
}
|
||||
// type Storage struct {
|
||||
// Actor db.Actor
|
||||
// FindOp func(entityArrPtr interface{}, params map[string]interface{}) db.Func
|
||||
// CreateOp func(entityPtr interface{}) db.Func
|
||||
// UpdateOp func(entityPtr interface{}) db.Func
|
||||
// DeleteOp func(entityPtr interface{}) db.Func
|
||||
// }
|
||||
|
||||
func (s *Storage) Find(entityArrPtr interface{}, params map[string]interface{}) (err error) {
|
||||
s.Actor.ActionChan <- s.FindOp(entityArrPtr, params)
|
||||
return nil
|
||||
}
|
||||
// func (s *Storage) Find(entityArrPtr interface{}, params map[string]interface{}) (err error) {
|
||||
// s.Actor.ActionChan <- s.FindOp(entityArrPtr, params)
|
||||
// return nil
|
||||
// }
|
||||
|
||||
func (s *Storage) Create(entityPtr interface{}) (err error) {
|
||||
s.Actor.ActionChan <- s.CreateOp(entityPtr)
|
||||
return nil
|
||||
}
|
||||
func (s *Storage) Update(entityPtr interface{}) (err error) {
|
||||
s.Actor.ActionChan <- s.UpdateOp(entityPtr)
|
||||
return nil
|
||||
}
|
||||
func (s *Storage) Delete(entityPtr interface{}) error {
|
||||
s.Actor.ActionChan <- s.DeleteOp(entityPtr)
|
||||
return nil
|
||||
}
|
||||
// func (s *Storage) Create(entityPtr interface{}) (err error) {
|
||||
// s.Actor.ActionChan <- s.CreateOp(entityPtr)
|
||||
// return nil
|
||||
// }
|
||||
// func (s *Storage) Update(entityPtr interface{}) (err error) {
|
||||
// s.Actor.ActionChan <- s.UpdateOp(entityPtr)
|
||||
// return nil
|
||||
// }
|
||||
// func (s *Storage) Delete(entityPtr interface{}) error {
|
||||
// s.Actor.ActionChan <- s.DeleteOp(entityPtr)
|
||||
// return nil
|
||||
// }
|
||||
|
Loading…
Reference in New Issue
Block a user