-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathinterface.go
More file actions
19 lines (17 loc) · 739 Bytes
/
interface.go
File metadata and controls
19 lines (17 loc) · 739 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// The typewriter package provides a framework for type-driven code generation. It implements the core functionality of gen.
//
// This package is primarily of interest to those who wish to extend gen with third-party functionality.
//
// More docs are available at https://clipperhouse.github.io/gen/typewriters.
package typewriter
import (
"io"
)
// Interface is the interface to be implemented for code generation via gen
type Interface interface {
Name() string
// Imports is a slice of imports required for the type; each will be written into the imports declaration.
Imports(t Type) []ImportSpec
// Write writes to the body of the generated code, following package declaration and imports.
Write(w io.Writer, t Type) error
}