Skip to main content

generate entire CRUD backend for golang echo and postgres with one command

Project description

GoForge

PyPi package version PyPi downloads PyPI version
generate entire CRUD backend for golang echo and postgres with one command 💙

Description

This tool is designed to be used for starting a project and editing the files later. It uses sqlc to generate all the sql related code. Make sure sqlc, goimports, gofmt, and docker are installed.

Prerequisites

snap install sqlc
go install golang.org/x/tools/cmd/goimports@latest

Installation

pip install goforge

Quick start

generate the project code

$ goforge -c example.yml

delete the project

$ goforge -c example.yml -d

API Configuration Documentation

edit the yaml as per your requirements

project_path: "example" # specifies the root directory for the project
schema_file: "example.sql" # defines the sql schema file for the project
project_mod: "example.com/my_crud_app" # go.mod project name
setup_postgres_local: true # setups a postgres docker instance for seamless testing
handlers:
  - name: CreateUser # handler function name
    path: "/v1/api/user" # api path
    sql:
       name: CreateUser # sqlc model method name
       annotation: exec # annotations compatible with sqlc, for eg: "one", "many" and "exec"
       query: "INSERT INTO users (name, email) VALUES ($1, $2)"
    request:
       method: "POST"
  - name: GetUsers
    path: "/v1/api/users"
    sql:
      name: GetUsers
      annotation: many
      query: "SELECT id, name, email FROM users LIMIT $1 AND OFFSET $2"
    request:
      method: "GET"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

goforge-0.2.0.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

goforge-0.2.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file goforge-0.2.0.tar.gz.

File metadata

  • Download URL: goforge-0.2.0.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for goforge-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5a9b4c24cbfd2374ae9bc10e6552af6e92abcdca0b50fe269d1d81c875a1508a
MD5 e03828d38db5bc1100766bc7855775cd
BLAKE2b-256 a074b348f569b3b834deaef3948ae6514cb5a31600274d4f2bbe7ded7095aa15

See more details on using hashes here.

File details

Details for the file goforge-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: goforge-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for goforge-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5869b94041be1ad27816881051b538c4e5689a2a0f5cbf0bc5949c4a7a16dec3
MD5 c45944dc1fad7bc847a93a4ce836bc47
BLAKE2b-256 2f6ec2d02e1c0475fa95d6b4a80eea2f16db3b578bfed5bf4420dff9134fc336

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page