templating

package
v0.0.0-...-bbac96e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2020 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Overview

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

tongue-demon. A cli tool to generate go code from your sql code. Copyright (C) 2020 Rotten Network

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.

Index

Constants

View Source
const (
	ConfigInterface = `` /* 136-byte string literal not displayed */

	Implementation = `` /* 977-byte string literal not displayed */

	InitTables = `` /* 197-byte string literal not displayed */

	MethodDefinition = `` /* 129-byte string literal not displayed */
	MethodTemplate   = `` /* 1049-byte string literal not displayed */

	Utils = `` /* 2734-byte string literal not displayed */

)
View Source
const (
	MySQLTestSchema = `` /* 709-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func Generate

func Generate(args Args) error

Types

type Args

type Args struct {
	Name       string
	Driver     string
	WorkDir    string
	SchemaPath string
	Pattern    string
}

type Method

type Method struct {
	Name     string
	Raw      string
	Model    *Model
	Scan     string
	Params   []statement.Parameter
	Returns  bool
	Multiple bool
}

func (*Method) Args

func (m *Method) Args() string

func (*Method) QParams

func (m *Method) QParams() string

type Model

type Model struct {
	Table   *statement.Table
	Columns []*statement.Column
	// contains filtered or unexported fields
}

func NewModel

func NewModel(raw string, table *statement.Table, columns []*statement.Column) *Model

func (*Model) GetColumnByName

func (m *Model) GetColumnByName(name string) *statement.Column

func (*Model) GetName

func (m *Model) GetName() string

func (*Model) ID

func (m *Model) ID() int64

type Relation

type Relation struct {
	Type statement.RelationType
	// contains filtered or unexported fields
}

func (*Relation) From

func (r *Relation) From() graph.Node

func (*Relation) Model

func (r *Relation) Model() *Model

func (*Relation) ReferencedBy

func (r *Relation) ReferencedBy() *Model

func (*Relation) ReversedEdge

func (r *Relation) ReversedEdge() graph.Edge

func (*Relation) To

func (r *Relation) To() graph.Node

type Repository

type Repository struct {
	*simple.DirectedGraph
}

func NewRepository

func NewRepository(models []*Model) *Repository

func (*Repository) Add

func (r *Repository) Add(m *Model)

func (*Repository) GetModelByName

func (r *Repository) GetModelByName(name string) *Model

func (*Repository) GetModels

func (r *Repository) GetModels() []*Model

func (*Repository) LoadModels

func (r *Repository) LoadModels(models []*Model)

func (*Repository) ReferencedBy

func (r *Repository) ReferencedBy(m *Model) []*Model

func (*Repository) References

func (r *Repository) References(m *Model) []*Model

func (*Repository) Relation

func (r *Repository) Relation(relation *Relation)

type SqlSourceFiles

type SqlSourceFiles map[string]string

func ReadSourceFiles

func ReadSourceFiles(pattern string) (SqlSourceFiles, error)

Jump to

Keyboard shortcuts

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