util

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMemberByJSON

func GetMemberByJSON(t *types.Type, jsonName string) *types.Member

GetMemberByJSON returns the child member of the type that has the given JSON name. It returns nil if no such member exists.

func IsDirectComparable

func IsDirectComparable(t *types.Type) bool

IsDirectComparable returns true if the type is safe to compare using "==". It is similar to gengo.IsComparable, but it doesn't consider Pointers to be comparable (we don't want shallow compare).

func IsNilableType

func IsNilableType(t *types.Type) bool

IsNilableType returns true if the argument type can be compared to nil.

func NativeType

func NativeType(t *types.Type) *types.Type

NativeType returns the Go native type of the argument type, with any intermediate typedefs removed. Go itself already flattens typedefs, but this handles it in the unlikely event that we ever fix that.

Examples: * Trivial:

  • given `int`, returns `int`
  • given `*int`, returns `*int`
  • given `[]int`, returns `[]int`

* Typedefs

  • given `type X int; X`, returns `int`
  • given `type X int; []X`, returns `[]X`

* Typedefs and pointers:

  • given `type X int; *X`, returns `*int`
  • given `type X *int; *X`, returns `**int`
  • given `type X []int; X`, returns `[]int`
  • given `type X []int; *X`, returns `*[]int`

func NonPointer

func NonPointer(t *types.Type) *types.Type

NonPointer returns the value-type of a possibly pointer type. If type is not a pointer, it returns the input type.

Types

This section is empty.

Jump to

Keyboard shortcuts

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