Automatically generate tags for golang struct.

gtag is a command tool that can automatically generate tags for golang struct.

Quick start

Install gtag into your GOPATH

go install github.com/sycki/gtag@latest

Batch process your files

gtag -a json:camel,yaml:camel,form:camel,gorm:snake model/*.go

File content

type User struct {
    Name               string `json:"name" yaml:"name" gorm:"name"`
    IdCard             string `json:"idCard" yaml:"idCard" gorm:"id_card"`
    ResidentialAddress string `json:"residentialAddress" yaml:"residentialAddress" gorm:"residential_address"`
    CompanyName        string `json:"companyName" yaml:"companyName" gorm:"company_name"`
}

Usage

gtag is a command tool that can automatically generate tags for golang struct.

Usage:  gtag [OPTIONS] filename ...

Options:
    -a, --add <tagName:style>
        Add tags to struct, tagName can be any string,
        style effective value: camel, snake, go, upper, lower.
    -r, --remove <tagName>
        Remove tags from struct, tagName can be any string.
    -i, --index <number>
        Specify the position for the --add option,
        -1 means cover all, 0 means insert to the front.

Examples:
    gtag -a yaml:camel -a gorm:snake model/*.go

    gtag -a yaml:camel,gorm:snake -i -1 -r json model/*.go
Similar Resources

Golang ORM with focus on PostgreSQL features and performance

go-pg is in a maintenance mode and only critical issues are addressed. New development happens in Bun repo which offers similar functionality but works with PostgreSQL, MySQL, and SQLite.

Jan 8, 2023

Very simple example of golang buffalo CRUD

Buffalo CRUD exemple Introduction Site du projet : https://gobuffalo.io/fr Documentation générale : https://gobuffalo.io/fr/docs/overview/ Documentati

Nov 7, 2021

The fantastic ORM library for Golang, aims to be developer friendly

GORM The fantastic ORM library for Golang, aims to be developer friendly. Overview Full-Featured ORM Associations (Has One, Has Many, Belongs To, Many

Nov 11, 2021

SQL mapper ORM framework for Golang

 SQL mapper ORM framework for Golang

SQL mapper ORM framework for Golang English 中文 Please read the documentation website carefully when using the tutorial. DOC Powerful Features High Per

Dec 8, 2021

Golang mysql orm, a personal learning project, dedicated to easy use of mysql

golang mysql orm 个人学习项目, 一个易于使用的mysql-orm mapping struct to mysql table golang结构

Dec 30, 2021

Go-mysql-orm - Golang mysql orm,dedicated to easy use of mysql

golang mysql orm 个人学习项目, 一个易于使用的mysql-orm mapping struct to mysql table golang结构

Jan 7, 2023

Mybatis for golang - SQL mapper ORM framework

SQL mapper ORM framework for Golang English 中文 Please read the documentation website carefully when using the tutorial. DOC Powerful Features High Per

Nov 10, 2022

Query: A Simple db helper with golang

Query: A Simple db helper with golang

Jul 20, 2022

Api-project - Api project with Golang, Gorm, Gorilla-Mux, Postgresql

TECHNOLOGIES GOLANG 1.14 GORM GORILLA-MUX POSTGRESQL API's PATHS For Product Ser

Nov 23, 2022
Related tags
QBS stands for Query By Struct. A Go ORM.

Qbs Qbs stands for Query By Struct. A Go ORM. 中文版 README ChangeLog 2013.03.14: index name has changed to {table name}_{column name}. For existing appl

Sep 9, 2022
Generate a Go ORM tailored to your database schema.
Generate a Go ORM tailored to your database schema.

SQLBoiler is a tool to generate a Go ORM tailored to your database schema. It is a "database-first" ORM as opposed to "code-first" (like gorm/gorp). T

Jan 2, 2023
CRUDist Model Driven Web Development. Automagically generate CRUD APIs from your model.

CRUDist - Model Driven API Development Automagicaly create CRUD APIs for your gorm models. Example Model definition type BaseModel struct { ID

Nov 15, 2021
Crud - A mysql crud code generate tool from table DDL sql file

crud is a mysql crud code generate tool 中文文档 Getting Started Overview Crud is a

Oct 13, 2022
100% type-safe ORM for Go (Golang) with code generation and MySQL, PostgreSQL, Sqlite3, SQL Server support. GORM under the hood.

go-queryset 100% type-safe ORM for Go (Golang) with code generation and MySQL, PostgreSQL, Sqlite3, SQL Server support. GORM under the hood. Contents

Dec 30, 2022
Golang Event Scheduling Sample Using Postgresql Database as persisting layer.

Database Based Event Scheduling Example that demonstrates super basic database based event scheduling. To run this example; Copy .env.example to .env

Nov 28, 2022
A pure golang SQL database for learning database theory

Go SQL DB 中文 "Go SQL DB" is a relational database that supports SQL queries for research purposes. The main goal is to show the basic principles and k

Dec 29, 2022
Golang Object Graph Mapper for Neo4j

GoGM Golang Object Graph Mapper v2 go get -u github.com/mindstand/gogm/v2 Features Struct Mapping through the gogm struct decorator Full support for

Dec 28, 2022
An orm library support nGQL for Golang

norm An ORM library support nGQL for Golang. Overview Build insert nGQL by struct / map (Support vertex, edge). Parse Nebula execute result to struct

Dec 1, 2022
golang orm

korm golang orm, 一个简单易用的orm, 支持嵌套事务 安装 go get github.com/wdaglb/korm go get github.com/go-sql-driver/mysql 支持数据库 mysql https://github.com/go-sql-driv

Oct 31, 2022