Welcome to the SurrealDB Go Starter Project, a solid foundation for your Go projects powered by SurrealDB.
To start a new Go project using this template, you can clone or download this repository.
After you have cloned the repository, you need to set up SurrealDB.
We recommend using Docker, but you can also install SurrealDB directly on your machine.
To set up a Docker container for SurrealDB, run the following command:
docker compose up -d
docker compose stop # Pauses the container
docker compose down # Tears down the container, wiping data
brew install surrealdb/tap/surreal
make dbrun
Now, you can start coding and developing your Go project.
Use the following golang-ci link to install it for your setup
Run make lint
Run make test
Run make run
- This command retrieves user data from the application. Replace
Ishrat
andShah
with your desired input.
curl --location 'http://0.0.0.0:8080/users' \
--header 'Content-Type: application/json' \
--data '{
"name": "Ishrat",
"surname": "Shah"
}'
This project is built for Hacktoberfest 2023, and anyone is welcome to contribute or offer suggestions on how to enhance this template for Go development with SurrealDB.
You are encouraged to open pull requests or issues, and I'll review them as soon as possible.
Happy coding with SurrealDB for Go!
To ensure code quality and that all tests pass before committing, we use pre-commit hooks.
First, install pre-commit using pip:
pip install pre-commit
Run the following command to install the pre-commit hook:
pre-commit install
You can run pre-commit manually on all files with:
pre-commit run --all-files
TODO: Move to Epic / Wiki soon
- Basic Main function
- Integrate Go HTTP Router
- Integrate simple GET/POST/PUT/DELETE event
- Integrate DB logic with HTTP Methods
- Integrate GET Method
- Integrate POST Method
- Integrate PUT Method
- Integrate DELETE Method
- Add data to DB
- Add logging