Include mysql column comments into generated types

This commit is contained in:
go-jet 2023-03-31 14:43:47 +02:00
parent fa69565dbf
commit 7b36f31cad
6 changed files with 33 additions and 11 deletions

View file

@ -198,6 +198,26 @@ func assertGeneratedFiles(t *testing.T) {
testutils.AssertFileContent(t, genTestDir3+"/dvds/model/actor.go", actorModelFile)
}
func TestModelColumnComment(t *testing.T) {
testutils.AssertFileContent(t, "./../.gentestdata/mysql/test_sample/model/link.go", `
//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//
package model
type Link struct {
ID int32 `+"`sql:\"primary_key\"`"+` // this is link id
URL string // link url
Name string // link name
Description *string // this is link description
}
`)
}
var mpaaRatingEnumFile = `
//
// Code generated by go-jet DO NOT EDIT.
@ -244,7 +264,7 @@ var Actor = newActorTable("dvds", "actor", "")
type actorTable struct {
mysql.Table
//Columns
// Columns
ActorID mysql.ColumnInteger
FirstName mysql.ColumnString
LastName mysql.ColumnString
@ -386,7 +406,7 @@ var ActorInfo = newActorInfoTable("dvds", "actor_info", "")
type actorInfoTable struct {
mysql.Table
//Columns
// Columns
ActorID mysql.ColumnInteger
FirstName mysql.ColumnString
LastName mysql.ColumnString