GithubHelp home page GithubHelp logo

chenxyzl / gsgen Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 124 KB

gsgen getter,setter,json.Marshal/Unmarshal,bson.Marshal/Unmarshal, support mongo dirty incremental update

License: MIT License

Go 98.98% Makefile 1.02%
bson code-generation generate getter incremental-update json mongo setter dirty

gsgen's Introduction

gsgen

  • 用go的ast来生成struct对象的方法列表getter,setter,json.Marshal/Unmarshal,bson.Marshal/Unmarshal,String,Clone,Clean,支持增量mongo的更新

怎么使用/how to run

  • 安装gsgen_tools: go install github.com/chenxyzl/gsgen/gsgen_tools@latest
  • 执行: gsgen_tools -d="./example/nest" -f=".model.go,.mod.go" -s -b -a="// test head annotations" -i="github.com/chenxyzl/gsgen/example/common,github.com/chenxyzl/gsgen/example/common.Common"
    • -d 表示目录
    • -f 表示文件后缀
    • -s 可选,表示导出setter[即true:Setter|false:setter]
    • -b 可选,表示生成bson的序列化和反序列化
    • -a 可选,数组,表示追加在头部的注释(一般用于给生成的文件添加额外的提示信息等)
    • -i 可选,数组,表示忽略检查的外部包,也可以指定外部包的特定类型(用于导入外部包类型,注:外部包对象的的安全无法保证,增量更新都不支持,建议外部包对象也用本工具生成)
    • 支持的命令参考请执行 ./gsgen_tools -h
  • 参考: Makefile

gsgen's People

Contributors

chenxyzl avatar

Stargazers

Archie avatar

Watchers

 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.