Giter Site home page Giter Site logo

usermicro's Introduction

user micro server

依赖 validator插件 :go install github.com/cloudwego/thrift-gen-validator@latest

生成or更新服务代码

目前项目微服务不再做字段检查校验,这部分交给业务层单独实现安全机制去处理

kitex --thrift-plugin validator -module github.com/ClubWeGo/usermicro -service usermicro ./idl/user.thrift

without validator : kitex -module github.com/ClubWeGo/usermicro -service usermicro ./idl/user.thrift

注意,一定要先go get下kitex:go get github.com/cloudwego/kitex@latest && go mod tidy

gorm相关

  • cmd/generateSchema :生成sql schema
  • cmd/gormGen :自动生成query代码

dal层

model

./dal/model/user.go

生成schema

cd cmd/migrateSchema/ && go run migrate.go

生成query

cd cmd/gormGen && go run gen.go

创建service层

包装dal中的query,向handler暴露方法

运行

  • 编译 : sh ./build.sh
  • 运行服务 : sh ./bootstrap.sh
  • 运行client : cd /cmd/client && go run userclient.go

配置信息:

mysql8

  • 库名 simpletk
  • user tk
  • password 123456
  • dsn := "tk:123456@tcp(127.0.0.1:3306)/simpletk?charset=utf8&parseTime=True&loc=Local"

etcd

  • 0.0.0.0:2379

docker部署

  • docker build -t imagename:version .
  • docker run -t -i --rm -p 8888:8888 --name testserver imagename:version /bin/bash

usermicro's People

Contributors

derekwin avatar darley-wey avatar zxhchime avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.