Documentation
¶
Index ¶
- type Info
- type Resolver
- func (r *Resolver) EmitStructType(typeName string, genCtx interface{}) error
- func (r *Resolver) EmitType(name string, sig string, body string) error
- func (r *Resolver) Gen(into io.Writer) error
- func (r *Resolver) Probe(name string) bool
- func (r *Resolver) Resolve(conf *config.DbConfig) error
- func (r *Resolver) TypeInfoOf(pgTypeName string) (*Info, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
// The Name of the type
Name string
// The package that the type with Name is in
Pkg string
// The name of a nullable version of the type
NullName string
// The package that the type with NullName is in (may be blank if
// the same as Pkg)
NullPkg string
// The name of a nullable version of the type that should be used
// for interfacing with the database. This type will get converted
// into `NullName` before it reaches any public-facing part of the
// generated code.
ScanNullName string
// The package that the type with ScanNullName type is in. May be
// blank if same as either one of the other two packages.
ScanNullPkg string
// A function for transforming a variable with the given name of type
// ScanNullName into a block of code which evaluates to a value of type
// NullName
NullConvertFunc func(string) string
// Given a variable name, SqlReceiver must return an appropriate wrapper
// around that variable which can be passed as a parameter to Rows.Scan.
// For many simple types, SqlReceiver will just wrap the variable in a
// reference.
SqlReceiver func(string) string
// Given a variable name, SqlReceiver must return an appropriate wrapper
// around that variable which can be passed as a parameter to Rows.Scan.
// Must work for the nullable receiver wrapper.
NullSqlReceiver func(string) string
// Given a variable name, SqlArgument must return an appropriate wrapper
// around that variable which can be passed as a parameter to `sql.Query`
SqlArgument func(string) string
// Given a variable name of type pointer-to-type, NullSqlArgument must return
// an appropriate value to pas as a parameter to `sql.Query`
NullSqlArgument func(string) string
// If this is a timestamp type, it has a time zone, otherwise this field
// is meaningless.
IsTimestampWithZone bool
// contains filtered or unexported fields
}
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
func (*Resolver) EmitStructType ¶
genCtx should be a meta.TableGenCtx. We ask for an interface{} param to avoid a cyclic dependency. Using an interface{} is fine because we are just going to pass it into the template evaluator anyway.
Click to show internal directories.
Click to hide internal directories.