parser

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Expression string
	Query      string
	AppendNext bool
}

type Definition

type Definition struct {
	Name   string
	Mapper MapperType
	IsTx   bool
}

type DynamicQuery

type DynamicQuery struct {
	QueryType       QueryType
	Conditions      []Condition
	Segments        []string
	Args            []string
	IndexOfWhere    int
	RemoveLastComma bool
}

type MapperType

type MapperType int8
const (
	MapperDefault MapperType = iota
	MapperBasicType
	MapperSingle
	MapperArray
)

type Parser

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

func NewParser

func NewParser() *Parser

NewParser create a new parser to parse sql file.

func (*Parser) LoadSqlFile

func (p *Parser) LoadSqlFile(sqlFilePath string) ([]Statement, []Syntax, error)

LoadSqlFile will load a sql file with given path and split it into different part for database usage, such as DDL and CURD.

type QueryType

type QueryType int8
const (
	QueryTypeInvalid QueryType = iota
	QueryTypeCreate
	QueryTypeInsert
	QueryTypeDelete
	QueryTypeUpdate
	QueryTypeSelect
)

type Statement

type Statement struct {
	Definition *Definition
	Query      *DynamicQuery
	Comment    string
}

type Syntax

type Syntax struct {
	DbFieldName string
	FieldName   string
	FieldType   string
}

Jump to

Keyboard shortcuts

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