sqlp

package module
v1.2.20240306 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2024 License: MIT Imports: 8 Imported by: 0

README

Sqlp2

Go Report Go Reference License Codecov Go compat Go module

Features

  • SQL mapper framework for Golang like MyBatis.

Installing

go mod:

go get github.com/valord577/sqlp2

Example

Changes

See the CHANGES for changes.

License

See the LICENSE for Rights and Limitations (MIT).

Documentation

Index

Constants

View Source
const (
	SqlModeNormal sqlmode = iota
	SqlModeBatch
)

SqlMode is an identifier that determines in what way the template is replaced before the SQL is executed.

Variables

View Source
var ErrTooManyResults = errors.New("expected one result (or nil), but found multiple")

ErrTooManyResults triggered when sql result rows more than one and no more variable to scan

Functions

This section is empty.

Types

type Mapper

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

Mapper represents the mapping of a go template file to SQL.

func ParseFS

func ParseFS(fsys fs.FS, fname string) (m *Mapper, err error)

ParseFS parses a go template file from fs.FS and returns *Mapper.

func ParseFile

func ParseFile(fname string) (m *Mapper, err error)

ParseFile parses a go template file and returns *Mapper.

func (*Mapper) Use

func (m *Mapper) Use(sql string) *executor

Use sets the name of SQL template and returns *exectuor for SQL execution and mapping.

Jump to

Keyboard shortcuts

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