Skip to content

A common api service use gin for example, including: authorization, access control, i18n, schdeuler task, swagger docs, cache and so on

Notifications You must be signed in to change notification settings

mozhemeng/common-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Common Service

Include

  • api (gin)
  • authorization (jwt-go)
  • access control (casbin)
  • sql (squirrel & sqlx)
  • no sql & cache (go-redis)
  • i18n (universal-translator)
  • scheduler task (gocron)
  • swagger api docs (swag)
  • rate limit (limiter)
  • config (viper)
  • log (zerolog & lumberjack)
  • command (cobra)
  • rpc server (grpc)

needed

  • redis
  • mysql

usage

build

go build

create database

CREATE DATABASE IF NOT EXISTS `cose` DEFAULT CHARACTER SET utf8mb4 DEFAULT COLLATE utf8mb4_general_ci;

prepare

including: create tables & create root role & create root user

common_server prepare/init/setup

run server

common_server server/service/api/run

run scheduler

common_server scheduler/task/job

update swagger api doc

swag init -g cmd/server.go

TODO

  • add test

About

A common api service use gin for example, including: authorization, access control, i18n, schdeuler task, swagger docs, cache and so on

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages