go-transform-struct-gen

module
v0.0.0-...-d91a165 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2023 License: MIT

README

go-transform-struct-gen

Example

package foo

type FooModel struct {
	Id   string
	Name string
	Age  int
}
package bar

type BarModel struct {
	Id        string
	Name      string
	Age       int
	CreatedAt time.Time
	UpdatedAt time.Time
}
% transform-struct-gen -src-struct '*github.com/utgwkk/go-transform-struct-gen/internal/fixtures/bar.BarModel' -dst-struct '*github.com/utgwkk/go-transform-struct-gen/internal/fixtures/foo.FooModel' -name ToFoo -type method
// This file is generated by github.com/utgwkk/go-transform-struct-gen
package bar

import "github.com/utgwkk/go-transform-struct-gen/internal/fixtures/foo"

func (src *BarModel) ToFoo() *foo.FooModel {
        return &foo.FooModel{
                Age:  src.Age,
                Id:   src.Id,
                Name: src.Name,
        }
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL