genpgfuncs

package module
v0.0.0-...-6398c55 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2020 License: MIT Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-genpgfuncs

Generate Go function wrappers for Postgresfunctions

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateFunctions

func GenerateFunctions(conn *sqlx.DB, sourceFile, packageName string, typeImport, typeMap map[string]string, argsDef bool, functionNames ...string) (err error)

func GenerateNoResultFunctions

func GenerateNoResultFunctions(conn *sqlx.DB, sourceFile, packageName string, typeImport, typeMap map[string]string, argsDef bool, functionNames ...string) (err error)

func GenerateNoResultFunctionsDBFirstArg

func GenerateNoResultFunctionsDBFirstArg(conn *sqlx.DB, sourceFile, packageName string, typeImport, typeMap map[string]string, argsDef bool, functions ...*Function) error

func GetEnumValues

func GetEnumValues(conn *sqlx.DB, enum string) (values []string, err error)

func PgToGoType

func PgToGoType(conn *sqlx.DB, t string, imports Imports, enums Enums, typeImport, typeMap map[string]string) string

func UUIDSliceToPgString

func UUIDSliceToPgString(ids []uu.ID) string

TODO: replace with uu.IDSlice

Types

type Enum

type Enum struct {
	Name   string
	Values []string
}

func (*Enum) Fprint

func (enum *Enum) Fprint(writer io.Writer)

func (*Enum) GoConstsAndValues

func (enum *Enum) GoConstsAndValues() (constsAndValues []string)

func (*Enum) GoName

func (enum *Enum) GoName() string

type Enums

type Enums map[string]Enum

func (Enums) Fprint

func (enums Enums) Fprint(writer io.Writer)

type Function

type Function struct {
	Namespace   string
	Name        string
	Kind        string
	Arguments   []FunctionArgument
	Result      string
	Description string
}

func IntrospectFunction

func IntrospectFunction(conn *sqlx.DB, namespace, name string) (f *Function, err error)

type FunctionArgument

type FunctionArgument struct {
	Name string
	Type string
}

func (*FunctionArgument) GoName

func (arg *FunctionArgument) GoName() string

func (*FunctionArgument) GoType

func (arg *FunctionArgument) GoType(conn *sqlx.DB, imports Imports, enums Enums, typeImport, typeMap map[string]string) string

type Imports

type Imports map[string]struct{}

func (Imports) Fprint

func (imports Imports) Fprint(writer io.Writer)

func (Imports) Require

func (imports Imports) Require(importPath string)

Jump to

Keyboard shortcuts

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