Documentation
¶
Index ¶
- Variables
- type File
- func (g *File) Content() ([]byte, error)
- func (g *File) Filename() string
- func (f *File) Import(importPath string)
- func (g *File) P(v ...any)
- func (f *File) QualifiedGoIdent(ident GoIdent) string
- func (f *File) SetPackageName(importPath string, packageName string)
- func (g *File) Write(p []byte) (n int, err error)
- type GoIdent
- type GoPackageName
Constants ¶
This section is empty.
Variables ¶
var ( // Standard library types XMLNameIdent = GoIdent{GoImportPath: "encoding/xml", GoName: "Name"} XMLAttrIdent = GoIdent{GoImportPath: "encoding/xml", GoName: "Attr"} ContextIdent = GoIdent{GoImportPath: "context", GoName: "Context"} TimeIdent = GoIdent{GoImportPath: "time", GoName: "Time"} BytesBufferIdent = GoIdent{GoImportPath: "bytes", GoName: "Buffer"} HTTPClientIdent = GoIdent{GoImportPath: "net/http", GoName: "Client"} HTTPRequestIdent = GoIdent{GoImportPath: "net/http", GoName: "Request"} HTTPResponseIdent = GoIdent{GoImportPath: "net/http", GoName: "Response"} IOReaderIdent = GoIdent{GoImportPath: "io", GoName: "Reader"} IOReadCloserIdent = GoIdent{GoImportPath: "io", GoName: "ReadCloser"} // Standard library functions FmtSprintfIdent = GoIdent{GoImportPath: "fmt", GoName: "Sprintf"} FmtErrorfIdent = GoIdent{GoImportPath: "fmt", GoName: "Errorf"} XMLMarshalIdent = GoIdent{GoImportPath: "encoding/xml", GoName: "Marshal"} XMLUnmarshalIdent = GoIdent{GoImportPath: "encoding/xml", GoName: "Unmarshal"} HTTPNewRequestWithContextIdent = GoIdent{GoImportPath: "net/http", GoName: "NewRequestWithContext"} HTTPStatusOKIdent = GoIdent{GoImportPath: "net/http", GoName: "StatusOK"} BytesNewReaderIdent = GoIdent{GoImportPath: "bytes", GoName: "NewReader"} IOReadAllIdent = GoIdent{GoImportPath: "io", GoName: "ReadAll"} // SOAP library types SOAPClientIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "Client"} SOAPClientOptionIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "ClientOption"} SOAPNewClientIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "NewClient"} SOAPWithEndpointIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "WithEndpoint"} SOAPEnvelopeIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "Envelope"} SOAPBodyIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "Body"} SOAPNamespaceIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "Namespace"} SOAPNewEnvelopeIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "NewEnvelope"} SOAPWithBodyIdent = GoIdent{GoImportPath: "github.com/way-platform/soap-go", GoName: "WithBody"} // Built-in types (no import path needed) StringIdent = GoIdent{GoImportPath: "", GoName: "string"} IntIdent = GoIdent{GoImportPath: "", GoName: "int"} BoolIdent = GoIdent{GoImportPath: "", GoName: "bool"} ByteIdent = GoIdent{GoImportPath: "", GoName: "byte"} ErrorIdent = GoIdent{GoImportPath: "", GoName: "error"} )
Common Go identifiers used in generated code. These provide type-safe access to commonly used types and functions.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents a generated Go file.
func (*File) Import ¶
Import adds a blank import to the file (for side effects). For normal imports, use QualifiedGoIdent instead.
func (*File) QualifiedGoIdent ¶ added in v0.21.0
QualifiedGoIdent returns the qualified Go identifier and manages imports automatically. If the identifier is from the same package, returns just the name. If from a different package, returns packageName.Name and ensures the import is added.
func (*File) SetPackageName ¶ added in v0.21.0
SetPackageName sets a custom package name for the given import path. This allows overriding the default package name derivation.
type GoIdent ¶ added in v0.21.0
type GoIdent struct { GoImportPath string // Import path, e.g., "encoding/xml" GoName string // Identifier name, e.g., "Name" }
GoIdent represents a Go identifier with its import path.
type GoPackageName ¶ added in v0.21.0
type GoPackageName string
GoPackageName represents a package name used in generated code.