Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gogjango/gjango
golang gin with go-pg orm
https://github.com/gogjango/gjango
gin-gonic go-pg golang
Last synced: 4 days ago
JSON representation
golang gin with go-pg orm
- Host: GitHub
- URL: https://github.com/gogjango/gjango
- Owner: gogjango
- License: apache-2.0
- Created: 2020-02-02T10:04:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-07T16:58:02.000Z (over 1 year ago)
- Last Synced: 2024-09-24T15:45:13.707Z (9 days ago)
- Topics: gin-gonic, go-pg, golang
- Language: Go
- Homepage:
- Size: 685 KB
- Stars: 42
- Watchers: 4
- Forks: 14
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
![CircleCI](https://img.shields.io/circleci/build/github/gogjango/gjango) [![Maintainability](https://api.codeclimate.com/v1/badges/33f9e187fee5dc62a4d7/maintainability)](https://codeclimate.com/github/gogjango/gjango/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/33f9e187fee5dc62a4d7/test_coverage)](https://codeclimate.com/github/gogjango/gjango/test_coverage) [![Go Report Card](https://goreportcard.com/badge/github.com/gogjango/gjango)](https://goreportcard.com/report/github.com/gogjango/gjango) ![GitHub](https://img.shields.io/github/license/calvinchengx/gin-go-pg)
# golang gin with go-pg orm
An example project that uses golang gin as webserver, and go-pg library for connecting with a PostgreSQL database.
## Get started
```bash
# postgresql config
cp .env.sample .env
source .env
``````bash
# get dependencies and run
go get -v ./...
go run .
```## Tests and coverage
### Run all tests
```bash
go test -coverprofile c.out ./...
go tool cover -html=c.out# or simply
./test.sh
```### Run only integration tests
```bash
go test -v -run Integration ./..../test.sh -i
```### Run only unit tests
```bash
go test -v -short ./...# without coverage
./test.sh -s
# with coverage
./test.sh -s -c
```## Schema migration and cli management commands
```bash
# create a new database based on config values in .env
go run . create_db# create our database schema
go run . create_schema# create our superadmin user, which is used to administer our API server
go run . create_superadmin# schema migration and subcommands are available in the migrate subcommand
# go run . migrate [command]
```