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: 0

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