Table of Contents
-
About The Project
-
Installation
- Usage
- MongoDB
- Contributing
- License
About The Project
Go wise with Wise!
Wise is a Go package offering database abstraction, simplifying database operations and interactions in Go applications. With Wise, developers can seamlessly work with different types of databases without worrying about the underlying implementation details.
This project aims to streamline database handling in Go applications, allowing developers to focus more on building features rather than dealing with the intricacies of database connections and queries.
(back to top)
Installation
Please note that this assumes you already have a Go environment set up. If not, you can check the documentation on the official Go website.
go get -u github.com/nextlevellabs/go-wise/wise
(back to top)
Usage
Wise supports multiple databases, offering flexibility in selecting the right one for your application.
Below are quick integration guides for supported databases.
MongoDB
Consider you have the following model:
type User struct {
ID string `json:"id"`
Name string `json:"name"`
}
You can create your repository as follows:
type UserRepository interface {
wise.MongoRepository[User]
}
// or
type UserRepository wise.MongoRepository[User]
If your document structure differs, you will need to tailor your own serializer.
Now, instead of repeatedly crafting a MongoDB implementation, you can simply invoke Wise:
func GetUser(ctx context.Context, id string) (User, error) {
return UserRepository.Find(ctx, id)
}
You can access more in-depth documentation by clicking here.
Coming soon...
For more examples, please refer to the Documentation.
(back to top)
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
)
- Commit your Changes (
git commit -m 'Add some AmazingFeature'
)
- Push to the Branch (
git push origin feature/AmazingFeature
)
- Open a Pull Request
(back to top)
License
Distributed under the GNU Affero General Public License. See LICENSE
for more information.
(back to top)