oracall

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MarkNull = "\u2400" // 0x2400 = nul
	//MarkValid  = "\u6eff" // 0x6eff = fill; full, satisfied
	MarkValid = "Valid" // 0x6eff = fill; full, satisfied
	//MarkHidden = "\u533f"     // 0x533f = hide
	MarkHidden = "_hidden"

	DefaultMaxVARCHARLength = 32767
	DefaultMaxRAWLength     = 32767
	DefaultMaxCHARLength    = 10
)
View Source
const (
	DIR_IN    = direction(1)
	DIR_OUT   = direction(2)
	DIR_INOUT = direction(3)
)
View Source
const (
	FLAVOR_SIMPLE = flavor(0)
	FLAVOR_RECORD = flavor(1)
	FLAVOR_TABLE  = flavor(2)
)

Variables

View Source
var Buffers = newBufPool(1 << 16)
View Source
var ErrInvalidArgument = errors.New("invalid argument")
View Source
var ErrMissingTableOf = errors.New("missing TableOf info")
View Source
var ErrUnknownSimpleType = errors.New("unknown simple type")
View Source
var Gogo bool
View Source
var MaxTableSize = 128

MaxTableSize is the default size of the array elements

View Source
var NumberAsString bool
View Source
var SkipMissingTableOf = true

Functions

func CamelCase

func CamelCase(text string) string

CamelCase converts f_kotveny_szam to FKotvenySzam

func CopyStruct

func CopyStruct(dest interface{}, src interface{}) error

func FilterAndGroup added in v0.2.16

func FilterAndGroup(filteredArgs chan<- []UserArgument, userArgs <-chan UserArgument, filter func(string) bool)

func FromContext added in v0.26.0

func FromContext(ctx context.Context) *slog.Logger

func MustOpenCsv

func MustOpenCsv(filename string) *os.File

MustOpenCsv opens the file, or panics on error

func OpenCsv

func OpenCsv(filename string) (*os.File, error)

OpenCsv opens the filename

func ParseDigits

func ParseDigits(s string, precision, scale int) error

func ReadCsv

func ReadCsv(userArgs chan<- UserArgument, r io.Reader) error

ReadCsv reads the csv from the Reader, and sends the arguments to the given channel.

func ReplOraPh

func ReplOraPh(s string, params []interface{}) string

func SaveFunctionTests added in v0.12.6

func SaveFunctionTests(dst io.Writer, functions []Function, pkg, pbImport string, saveStructs bool) error

func SaveFunctions

func SaveFunctions(dst io.Writer, functions []Function, pkg, pbImport string, saveStructs bool) error

func SaveProtobuf

func SaveProtobuf(dst io.Writer, functions []Function, pkg, path string) error

func SetLogger added in v0.23.0

func SetLogger(lgr *slog.Logger)

func SnakeCase added in v0.24.2

func SnakeCase(s string) string

SnakeCase converts FKotvenySzam to f_kotveny_szam

func UnoCap

func UnoCap(text string) string

func WithContext added in v0.26.0

func WithContext(ctx context.Context, logger *slog.Logger) context.Context

Types

type Annotation added in v0.4.0

type Annotation struct {
	Package, Type, Name, Other string
	Size                       int
}

func (Annotation) FullName added in v0.4.0

func (a Annotation) FullName() string

func (Annotation) FullOther added in v0.4.0

func (a Annotation) FullOther() string

func (Annotation) String added in v0.4.0

func (a Annotation) String() string

type Argument

type Argument struct {
	TableOf *Argument // this argument is a table (array) of this type

	Name             string
	Type, TypeName   string
	AbsType          string
	Charset, IndexBy string
	RecordOf         []NamedArgument //this argument is a record (map) of this type
	PlsType
	Charlength uint
	Flavor     flavor
	Direction  direction
	Precision  uint8
	Scale      uint8
	// contains filtered or unexported fields
}

func NewArgument

func NewArgument(name, dataType, plsType, typeName, dirName string, dir direction,
	charset, indexBy string, precision, scale uint8, charlength uint) Argument

func (Argument) IsInput

func (a Argument) IsInput() bool

func (Argument) IsNestedTable added in v0.26.3

func (a Argument) IsNestedTable() bool

Should check for Associative Array (when using INDEX BY)

func (Argument) IsOutput

func (a Argument) IsOutput() bool

func (Argument) String

func (a Argument) String() string

func (Argument) TypeString added in v0.27.5

func (a Argument) TypeString(prefix, indent string) string

type Function

type Function struct {
	LastDDL       time.Time
	Replacement   *Function
	Returns       *Argument
	Package       string
	Documentation string
	Args          []Argument
	Tag           []string

	ReplacementIsJSON bool
	// contains filtered or unexported fields
}

func ApplyAnnotations added in v0.4.0

func ApplyAnnotations(functions []Function, annotations []Annotation) []Function

func ParseArguments

func ParseArguments(userArgs <-chan []UserArgument, filter func(string) bool) []Function

func ParseCsv

func ParseCsv(r io.Reader, filter func(string) bool) (functions []Function, err error)

ParseCsv parses the csv

func ParseCsvFile

func ParseCsvFile(filename string, filter func(string) bool) (functions []Function, err error)

ParseCsv reads the given csv file as user_arguments The csv should be an export of

SELECT object_id, subprogram_id, package_name, sequence, object_name,
       data_level, argument_name, in_out,
       data_type, data_precision, data_scale, character_set_name,
       pls_type, char_length, type_owner, type_name, type_subname, type_link
  FROM user_arguments
  ORDER BY object_id, subprogram_id, SEQUENCE;

func (Function) GenChecks

func (f Function) GenChecks(w io.Writer) (string, error)

func (Function) HasCursorOut

func (f Function) HasCursorOut() bool

func (Function) Name

func (f Function) Name() string

func (Function) PlsqlBlock

func (fun Function) PlsqlBlock(checkName string) (plsql, callFun string)

SavePlsqlBlock saves the plsql block definition into writer

func (Function) RealName added in v0.4.2

func (f Function) RealName() string

func (Function) SaveProtobuf

func (f Function) SaveProtobuf(dst io.Writer, seen map[string]struct{}) error

func (Function) SaveStruct

func (f Function) SaveStruct(dst io.Writer, out bool) error

func (Function) String

func (f Function) String() string

type NamedArgument

type NamedArgument struct {
	*Argument
	Name string
}

type PlsType

type PlsType struct {
	Precision, Scale uint8
	// contains filtered or unexported fields
}

func NewPlsType

func NewPlsType(ora string, precision, scale uint8) PlsType

NewArg returns a new argument to ease arument conversions.

func (PlsType) FromOra

func (arg PlsType) FromOra(dst, src, varName string) string

FromOra retrieves the value of the argument with arg type, from src variable to dst variable.

func (PlsType) GetOra

func (arg PlsType) GetOra(src, varName string) string

func (PlsType) String

func (arg PlsType) String() string

func (PlsType) ToOra

func (arg PlsType) ToOra(dst, src string, dir direction) (expr string, variable string)

ToOra adds the value of the argument with arg type, from src variable to dst variable.

type QueryError added in v0.20.1

type QueryError struct {
	// contains filtered or unexported fields
}

QueryError holds a query with a (hopefully parsed) error with line info.

func NewQueryError added in v0.20.1

func NewQueryError(qry string, err error) *QueryError

NewQueryError wraps the error, parsing the error line number if possible.

func (*QueryError) Code added in v0.20.1

func (qe *QueryError) Code() int

func (*QueryError) Error added in v0.20.1

func (qe *QueryError) Error() string

func (*QueryError) Line added in v0.20.1

func (qe *QueryError) Line() string

func (*QueryError) LineNo added in v0.20.1

func (qe *QueryError) LineNo() int

func (*QueryError) Unwrap added in v0.20.1

func (qe *QueryError) Unwrap() error

type UserArgument

type UserArgument struct {
	PackageName string `sql:"PACKAGE_NAME"`
	ObjectName  string `sql:"OBJECT_NAME"`
	LastDDL     time.Time

	ArgumentName string `sql:"ARGUMENT_NAME"`
	InOut        string `sql:"IN_OUT"`

	DataType string `sql:"DATA_TYPE"`

	CharacterSetName string `sql:"CHARACTER_SET_NAME"`
	IndexBy          string `sql:"INDEX_BY"`

	PlsType     string `sql:"PLS_TYPE"`
	TypeLink    string `sql:"TYPE_LINK"`
	TypeOwner   string `sql:"TYPE_OWNER"`
	TypeName    string `sql:"TYPE_NAME"`
	TypeSubname string `sql:"TYPE_SUBNAME"`

	ObjectID     uint `sql:"OBJECT_ID"`
	SubprogramID uint `sql:"SUBPROGRAM_ID"`

	CharLength uint `sql:"CHAR_LENGTH"`
	Position   uint `sql:"POSITION"`

	DataPrecision uint8 `sql:"DATA_PRECISION"`
	DataScale     uint8 `sql:"DATA_SCALE"`
	DataLevel     uint8 `sql:"DATA_LEVEL"`
}

UserArgument represents the required info from the user_arguments view

Jump to

Keyboard shortcuts

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