types

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package types provides MySQL database type to Go type mapping.

Package types provides PostgreSQL database type to Go type mapping.

Package types provides database column type to Go type mapping.

Index

Constants

View Source
const (
	KindNumeric = "NUMERIC"
	KindString  = "STRING"
	KindBytes   = "BYTES"
	KindTime    = "TIME"
	KindEnum    = "ENUM"
	KindBoolean = "BOOL"
	KindStruct  = "STRUCT"
	KindArray   = "ARRAY"
)

Variables

View Source
var ErrUnsupportedArrayType = errors.New("unsupported array type")
View Source
var ErrUnsupportedType = errors.New("unsupported type")

Functions

func Register

func Register(name string, m Mapper)

Register registers a mapper for type mapping.

func TypeToKind

func TypeToKind(typ string) string

Types

type Desc

type Desc struct {
	Type    string   // go Type
	Kind    string   // logic Type
	Imports []string // imports packages
}

func NewDesc

func NewDesc(name string, c *schema.Column) (Desc, error)

NewDesc returns a Desc for the given mapper name and column.

type Mapper

type Mapper interface {
	Desc(c *schema.Column) (Desc, error)
}

Mapper is the interface that wraps the Desc method for type mapping.

Jump to

Keyboard shortcuts

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