typecheck

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package typecheck provides type-checking predicates for common Go types used in Datapages handler signatures.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventTypeNameOf

func EventTypeNameOf(
	expr ast.Expr,
	info *types.Info,
	eventTypeNames map[string]struct{},
) (string, bool)

EventTypeNameOf returns the EventXXX type name for expr if it is (or points to) a named type whose name is in eventTypeNames.

func ImplementsTextUnmarshaler added in v0.4.2

func ImplementsTextUnmarshaler(t types.Type) bool

ImplementsTextUnmarshaler reports whether t or *t implements encoding.TextUnmarshaler.

func IsBool

func IsBool(t types.Type) bool

IsBool reports whether t's underlying type is bool.

func IsError

func IsError(t types.Type) bool

IsError reports whether t is the builtin "error" type.

func IsEventType added in v0.4.0

func IsEventType(
	expr ast.Expr,
	info *types.Info,
	eventTypeName string,
) bool

IsEventType reports whether the expression resolves to the named event type eventTypeName.

func IsInputFieldType added in v0.4.2

func IsInputFieldType(t types.Type) bool

IsInputFieldType reports whether t is a supported type for path and query struct fields: string, bool, integers (int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64), floats (float32, float64), or any type that implements encoding.TextUnmarshaler.

func IsInt

func IsInt(t types.Type) bool

IsInt reports whether t's underlying type is int.

func IsPtrToDatastarSSE

func IsPtrToDatastarSSE(
	expr ast.Expr, info *types.Info,
) bool

IsPtrToDatastarSSE reports whether expr resolves to *datastar.ServerSentEventGenerator.

func IsPtrToNetHTTPReq

func IsPtrToNetHTTPReq(
	expr ast.Expr, info *types.Info,
) bool

IsPtrToNetHTTPReq reports whether expr resolves to *net/http.Request.

func IsSessionType

func IsSessionType(
	expr ast.Expr, info *types.Info,
) bool

IsSessionType reports whether expr resolves to a named type called "Session".

func IsString

func IsString(t types.Type) bool

IsString reports whether t's underlying type is string.

func IsTemplComponent

func IsTemplComponent(t types.Type) bool

IsTemplComponent reports whether t is github.com/a-h/templ.Component.

func IsTimeTime

func IsTimeTime(t types.Type) bool

IsTimeTime reports whether t is time.Time from the standard library.

func IsUint64 added in v0.8.0

func IsUint64(t types.Type) bool

IsUint64 reports whether t's underlying type is uint64.

Types

This section is empty.

Jump to

Keyboard shortcuts

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