mockio

command module
v0.0.0-...-d4e1695 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: Apache-2.0 Imports: 28 Imported by: 0

README

mockio

This code is forked from https://github.com/golang/mock/tree/master/mockgen

Usage

Generate io struct of interface method.

go run github.com/ispec-inc/civgen-go/mockio \
	--source {source file path}
	--destination {destination file path}
	[other options which are same as github.com/golang/mock/mockgen]

Example

Generate example mockio structs.

go run github.com/ispec-inc/civgen-go/mockio \
	--source example/pkg/domain/repository/user.go
	--destination example/pkg/domain/repository/mockio/user.go
// Source
type User interface {
	Get(id int64) (model.User, apperror.Error)
	List(ids []int64) ([]model.User, apperror.Error)
}

// Generated
type UserGet struct {
	Time  int
	ArgId int64
	Ret0  model.User
	Ret1  apperror.Error
}

type UserList struct {
	Time   int
	ArgIds []int64
	Ret0   []model.User
	Ret1   apperror.Error
}

See example/pkg/domain/repository/mockio/user.go for more details.

Documentation

Overview

MockIO generates mock implementations of Go interfaces.

Directories

Path Synopsis
Package model contains the data model necessary for generating mock implementations.
Package model contains the data model necessary for generating mock implementations.

Jump to

Keyboard shortcuts

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