Documentation ¶
Index ¶
- Variables
- func GetDirectiveName(v *types.Var) string
- func ImplementsAfterScanner(named *types.Named) bool
- func ImplementsErrorHandler(named *types.Named) bool
- func ImplementsErrorInfoHandler(named *types.Named) bool
- func ImplementsGosqlConn(named *types.Named) bool
- func ImplementsGosqlFilterConstructor(typ types.Type) bool
- func ImplementsJSONMarshaler(named *types.Named) bool
- func ImplementsJSONUnmarshaler(named *types.Named) bool
- func ImplementsScanner(named *types.Named) bool
- func ImplementsValuer(named *types.Named) bool
- func ImplementsXMLMarshaler(named *types.Named) bool
- func ImplementsXMLUnmarshaler(named *types.Named) bool
- func IsContext(typ types.Type) bool
- func IsDirective(ident string, typ types.Type) bool
- func IsEmptyInterface(typ types.Type) bool
- func IsEmptyInterfaceSlice(typ types.Type) bool
- func IsError(typ types.Type) bool
- func IsJSONMarshaler(mm Methoder) bool
- func IsJSONUnmarshaler(mm Methoder) bool
- func IsNiladicFunc(typ types.Type) bool
- func IsScanner(mm Methoder) bool
- func IsSqlDriverValue(typ types.Type) bool
- func IsSqlResult(typ types.Type) bool
- func IsSqlRowPtr(typ types.Type) bool
- func IsSqlRowsPtr(typ types.Type) bool
- func IsString(typ types.Type) bool
- func IsStringMap(typ types.Type) bool
- func IsTime(typ types.Type) bool
- func IsValuer(mm Methoder) bool
- func IsXMLMarshaler(mm Methoder) bool
- func IsXMLUnmarshaler(mm Methoder) bool
- type Methoder
- type NamedStruct
Constants ¶
This section is empty.
Variables ¶
var ErrBadType = errors.New("bad type")
Functions ¶
func GetDirectiveName ¶
GetDirectiveName returns the name of the gosql directive type of the given variable. If the type of the given variable is not a directive an empty string will be returned instead.
func ImplementsAfterScanner ¶
ImplementsAfterScanner reports whether or not the given named type implements the "gosql.AfterScanner" interface.
func ImplementsErrorHandler ¶
ImplementsErrorHandler reports whether or not the given named type implements the "gosql.ErrorHandler" interface.
func ImplementsErrorInfoHandler ¶
ImplementsErrorInfoHandler reports whether or not the given named type implements the "gosql.ErrorInfoHandler" interface.
func ImplementsGosqlConn ¶
ImplementsGosqlConn reports whether or not the given named type implements the "gosql.Conn" interface.
func ImplementsGosqlFilterConstructor ¶
ImplementsGosqlFilterConstructor reports whether or not the given named type implements the "gosql.FilterConstructor" interface.
func ImplementsJSONMarshaler ¶
ImplementsJSONMarshaler reports whether or not the given named type implements the "encoding/json.Marshaler" interface. If the named type's underlying type is an interface type, ImplementsJSONMarshaler will report whether or not that interface type declares, or embeds, the "MarshalJSON() ([]byte, error)" method.
func ImplementsJSONUnmarshaler ¶
ImplementsJSONUnmarshaler reports whether or not the given named type implements the "encoding/json.Unmarshaler" interface. If the named type's underlying type is an interface type, ImplementsJSONUnmarshaler will report whether or not that interface type declares, or embeds, the "UnmarshalJSON([]byte) (error)" method.
func ImplementsScanner ¶
ImplementsScanner reports whether or not the given named type implements the "database/sql.Scanner" interface. If the named type's underlying type is an interface type, ImplementsScanner will report whether or not that interface type declares, or embeds, the "Scan(interface{}) error" method.
func ImplementsValuer ¶
ImplementsValuer reports whether or not the given named type implements the "database/sql/driver.Valuer" interface. If the named type's underlying type is an interface type, ImplementsValuer will report whether or not that interface type declares, or embeds, the "Value() (driver.Value, error)" method.
func ImplementsXMLMarshaler ¶
ImplementsXMLMarshaler reports whether or not the given named type implements the "encoding/xml.Marshaler" interface. If the named type's underlying type is an interface type, ImplementsXMLMarshaler will report whether or not that interface type declares, or embeds, the "MarshalXML(*xml.Encoder, xml.StartElement) (error)" method.
func ImplementsXMLUnmarshaler ¶
ImplementsXMLUnmarshaler reports whether or not the given named type implements the "encoding/xml.Unmarshaler" interface. If the named type's underlying type is an interface type, ImplementsXMLUnmarshaler will report whether or not that interface type declares, or embeds, the "UnmarshalXML(*xml.Decoder, xml.StartElement) (error)" method.
func IsContext ¶
IsContext reports whether or not the given type is the standard "context.Context" type.
func IsDirective ¶
IsDirective reports whether or not the given type is a "github.com/frk/gosql" directive type.
func IsEmptyInterface ¶
IsEmptyInterface reports whether or not the given type is the "interface{}" type.
func IsEmptyInterfaceSlice ¶ added in v0.0.3
IsEmptyInterfaceSlice reports whether or not the given type is the "[]interface{}" type.
func IsJSONMarshaler ¶
IsJSONMarshaler reports whether or not the given Methoder type declares, or embeds, the "MarshalJSON() ([]byte, error)" method.
func IsJSONUnmarshaler ¶
IsJSONUnmarshaler reports whether or not the given Methoder type declares, or embeds, the "UnmarshalJSON([]byte) (error)" method.
func IsNiladicFunc ¶
IsNiladicFunc reports whether or not the given type is the "func()" type.
func IsScanner ¶
IsScanner reports whether or not the given Methoder type declares, or embeds, the "Scan(interface{}) error" method.
func IsSqlDriverValue ¶
IsSqlDriverValue reports whether or not the given type is the "database/sql/driver.Value" type.
func IsSqlResult ¶
IsSqlResult reports whether or not the given type is the standard "sql.Result" type.
func IsSqlRowPtr ¶
IsSqlRowPtr reports whether or not the given type is the standard "*sql.Row" type.
func IsSqlRowsPtr ¶
IsSqlRowsPtr reports whether or not the given type is the standard "*sql.Rows" type.
func IsStringMap ¶
IsStringMap reports whether or not the given type is the "map[string]string" type.
func IsTime ¶
IsTime reports whether or not the given type is the "time.Time" type. IsTime returns true also for types that embed "time.Time" directly, this is to provide support for custom timestamp types.
func IsValuer ¶
IsValuer reports whether or not the given Methoder type declares, or embeds, the "Value() (driver.Value, error)" method.
func IsXMLMarshaler ¶
IsXMLMarshaler reports whether or not the given Methoder type declares, or embeds, the "MarshalXML(*xml.Encoder, xml.StartElement) (error)" method.
func IsXMLUnmarshaler ¶
IsXMLUnmarshaler reports whether or not the given Methoder type declares, or embeds, the "UnmarshalXML(*xml.Decoder, xml.StartElement) (error)" method.
Types ¶
type Methoder ¶
Methoder represents a type with methods. It is implicitly implemented by *types.Interface and *types.Named.
type NamedStruct ¶
func GetStruct ¶
func GetStruct(v *types.Var) (*NamedStruct, error)
GetStruct is a helper function that returns a *NamedStruct value that represents the struct type of the the given *types.Var. If the struct type is unnamed then the Named field of the *NamedStruct value will remain uninitialized. If the var's type is not a struct then GetStruct will return an error.