Golang Service Template

Overview

Golang Service Template

Golang back-end service template. Using this template, you can get started with back-end projects quickly.

Web Framework ORM Database Driver Configuration Manager Log Manager API Documentation
labstack/echo/v4 gorm.io/gorm gorm.io/driver/mysql spf13/viper sirupsen/logrus swaggo/echo-swagger

Configuration

  1. Create database and user in MySQL, and grant privileges to user.
CREATE DATABASE buz;
CREATE USER 'foo'@'localhost' IDENTIFIED BY 'bar';
GRANT ALL PRIVILEGES ON buz.* TO 'foo'@'localhost';
  1. Create a file named conf.yaml in the project's root directory.
sql:
  username: foo
  password: bar
  db_name: buz
  1. To generate API doc, you need to execute the following commands:
go install github.com/swaggo/swag/cmd/[email protected]  # download swag, a doc generator
swag init  # docs will be written into `docs/` directory
  1. Compile and run this project. You will find API doc in http://localhost:1323/api/doc/index.html on default.
  2. Change the go module name of this project to whatever you like.

Usage

  1. To create tables, add structs in model/. model/foo.go is an example of such struct. Then, add the struct to DB.AutoMigrate in model/init.go.
  2. Add business logics in controller/, then add router in controller/routers.go.
  3. Write API doc alongside with the controller function. controller/foo.go is an example.
You might also like...
Template for Golang rest API using Fiber

Rest API Setup DB sudo -S docker-compose -f db.yml up -d Build container sudo -S docker build -t rest-api-image . Run container from image sudo -S doc

Clean Architecture template for Golang services
Clean Architecture template for Golang services

Go Clean template Clean Architecture template for Golang services Overview The purpose of the template is to show: how to organize a project and preve

Clean Architecture template for Golang services

Go Clean template Clean Architecture template for Golang services Overview The purpose of the template is to show: how to organize a project and preve

A Go Template Library. A bunch of utils and collections that are not part of the Golang standard library.

gotl A Go Template Library. A bunch of utils and collections that are not part of the Golang standard library. Prerequisites This library is using ext

Competitive Programming Template for Golang

Go Competitive Programming Template How to use this repo? Check the commit histo

Template user CRUD operations with golang, JWT, postgres

user-api-golang A CRUD API template for perform operations on users. Written in golang. Components Server: Golang with go-chi as mux and zap for loggi

Template for depency injection in golang (no libraries)

Go Dependency Injection (No libraries) Project template based on the most common layered architecture style, made to explain how to do dependency inje

This is a simple GoLang script template.

This is a simple GoLang script template.

Fleet Manager Golang Template

Fleet Manager Go Template provides a starting point codebase in Go to create your own Fleet Management service

Comments
Owner
Ralph
Stare into the void | @QSCTech | @ZJUSCT | @milkice233
Ralph
Go-project-template - Template for a golang project

This is a template repository for golang project Usage Go to github: https://git

KyberNetwork 4 Oct 25, 2022
Wrapper package for Go's template/html to allow for easy file-based template inheritance.

Extemplate Extemplate is a small wrapper package around html/template to allow for easy file-based template inheritance. File: templates/parent.tmpl <

Danny van Kooten 51 Nov 13, 2022
Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template

quicktemplate A fast, powerful, yet easy to use template engine for Go. Inspired by the Mako templates philosophy. Features Extremely fast. Templates

Aliaksandr Valialkin 2.6k Nov 29, 2022
Simple system for writing HTML/XML as Go code. Better-performing replacement for html/template and text/template

Simple system for writing HTML as Go code. Use normal Go conditionals, loops and functions. Benefit from typing and code analysis. Better performance than templating. Tiny and dependency-free.

Nelo Mitranim 4 Apr 13, 2022
A template to build dynamic web apps quickly using Go, html/template and javascript

gomodest-template A modest template to build dynamic web apps in Go, HTML and sprinkles and spots of javascript. Why ? Build dynamic websites using th

Adnaan Badr 87 Nov 23, 2022
Made from template temporalio/money-transfer-project-template-go

Temporal Go Project Template This is a simple project for demonstrating Temporal with the Go SDK. The full 20 minute guide is here: https://docs.tempo

MarkGorewicz 0 Jan 6, 2022
Go-api-template - A rough template to give you a starting point for your API

Golang API Template This is only a rough template to give you a starting point f

Only Tunes Radio 3 Jan 14, 2022
Golang Service Template

Golang Service Template Golang back-end service template. Using this template, you can get started with back-end projects quickly. Web Framework ORM D

Ralph 18 Jun 8, 2022
A general purpose golang CLI template for Github and Gitlab

golang-cli-template A general purpose project template for golang CLI applications This template serves as a starting point for golang commandline app

null 22 Dec 2, 2022
Clean arch Golang template project

Template No previous versions, still working on this one to reach v1. API Service for pssword app mobilde based on : https://github.com/bxcodec/go-cle

Diego Alberto León López 2 Sep 15, 2021