ifgen

command
v0.0.0-...-c34ab15 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: MIT Imports: 10 Imported by: 0

README

Tool to generate interface, struct, constructor, function at once

How to Use

  1. clone this repository and cd ./ifgen
  2. go install
  3. run ifgen -c
  4. type information, following guide
  5. output is shown in stdout. if you specified -c option, output is copied to clipboard.

Options

 % ifgen -h                                                                 
Usage of ifgen:
  -c    copy to clipboard

Output is like below

pkg name: service
interface name: interface name: User
Function Name(if nothing type ! and enter): Get
Arg(if nothing type ! and enter): id
Type: string
Arg(if nothing type ! and enter): !
Return(if nothing type ! and enter): user
Type: User
Return(if nothing type ! and enter): !
Function Name(if nothing type ! and enter): !
package service

type User interface {
	Get(
		id string,
	) (
		user User,
	)
}

type user struct{}

func NewUser() *user {
	return &user{}
}

func (s *user) Get(
	id string,
) (
	user User,
) {
	return
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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