python

package module
v0.16.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(_ context.Context, req *plugin.Request) (*plugin.Response, error)

func HashComment

func HashComment(s string) string

Types

type Config

type Config struct {
	EmitExactTableNames         bool     `json:"emit_exact_table_names"`
	EmitSyncQuerier             bool     `json:"emit_sync_querier"`
	EmitAsyncQuerier            bool     `json:"emit_async_querier"`
	Package                     string   `json:"package"`
	Out                         string   `json:"out"`
	EmitPydanticModels          bool     `json:"emit_pydantic_models"`
	QueryParameterLimit         *int32   `json:"query_parameter_limit"`
	InflectionExcludeTableNames []string `json:"inflection_exclude_table_names"`
}

func (Config) MarshalEasyJSON

func (v Config) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (Config) MarshalJSON

func (v Config) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*Config) UnmarshalEasyJSON

func (v *Config) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*Config) UnmarshalJSON

func (v *Config) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Constant

type Constant struct {
	Name  string
	Type  string
	Value string
}

type Enum

type Enum struct {
	Name      string
	Comment   string
	Constants []Constant
}

type Field

type Field struct {
	Name    string
	Type    pyType
	Comment string
}

type Query

type Query struct {
	Cmd          string
	Comments     []string
	MethodName   string
	FieldName    string
	ConstantName string
	SQL          string
	SourceName   string
	Ret          QueryValue
	Args         []QueryValue
}

A struct used to generate methods and fields on the Queries struct

func (Query) AddArgs

func (q Query) AddArgs(args *pyast.Arguments)

func (Query) ArgDictNode

func (q Query) ArgDictNode() *pyast.Node

type QueryValue

type QueryValue struct {
	Emit   bool
	Name   string
	Struct *Struct
	Typ    pyType
}

func (QueryValue) Annotation

func (v QueryValue) Annotation() *pyast.Node

func (QueryValue) EmitStruct

func (v QueryValue) EmitStruct() bool

func (QueryValue) IsStruct

func (v QueryValue) IsStruct() bool

func (QueryValue) RowNode

func (v QueryValue) RowNode(rowVar string) *pyast.Node

type Struct

type Struct struct {
	Table   plugin.Identifier
	Name    string
	Fields  []Field
	Comment string
}

Directories

Path Synopsis
cmd
sqlc-gen-python command

Jump to

Keyboard shortcuts

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