go-wise

module
v0.0.0-...-c4d4255 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2024 License: AGPL-3.0

README

Contributors Forks Stargazers Issues AGPL


Logo

Wise

Databases abstraction for Go
Explore the docs »
Report Bug · Request Feature · Open Issues

Table of Contents
  1. About The Project
  2. Installation
  3. Usage
    1. MongoDB
  4. Contributing
  5. 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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the GNU Affero General Public License. See LICENSE for more information.

(back to top)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL