goma

package module
v0.0.0-...-688904c Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2016 License: Apache-2.0 Imports: 8 Imported by: 5

README

goma (胡麻)

Circle CI GoDoc

goma (胡麻) is a Database access framework for golang(Go)

I'm making based on Doma;

golang version 1.4.0 〜

Install

$ go get gopkg.in/kyokomi/goma.v1/gen/goma

latest Ver

$ go get github.com/kyokomi/goma/gen/goma

Usage

GitBook Document

Command
   init-config	create example config file
   gen		generate code by params
   gen-config	generate code by config
   help, h	Shows a list of commands or help for one command

Support Driver

Author

kyokomi

Licence

Apache License Version 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateQuery

func GenerateQuery(queryString string, argsMap map[string]interface{}) (string, []interface{}, error)

func MySQLGenerateQuery

func MySQLGenerateQuery(queryString string, argsMap map[string]interface{}) (string, []interface{}, error)

MySQLGenerateQuery generate bind args query

func Open

func Open(configPath string) (*sql.DB, error)

Open is create goma client. - database open

func OpenOptions

func OpenOptions(options Options) (*sql.DB, error)

OpenOptions is create goma client. - database open

func PostgresGenerateQuery

func PostgresGenerateQuery(queryString string, argsMap map[string]interface{}) (string, []interface{}, error)

PostgresGenerateQuery generate bind args query

Types

type Goma

type Goma struct {
	*sql.DB
	// contains filtered or unexported fields
}

Goma is sql.DB access wrapper.

func (*Goma) Close

func (d *Goma) Close() error

Close sql.DB close.

type Options

type Options struct {
	// driver and dataSource
	Driver   string `json:"driver"`   // DriverName
	UserName string `json:"user"`     // access user name `admin`
	PassWord string `json:"password"` // access user password `password`
	Host     string `json:"host"`     // localhost
	Port     int    `json:"port"`     // 3306
	DBName   string `json:"db"`       // DataBaseName
	Location string `json:"location"` // Location name

	// postgres
	SSLMode string `json:"ssl"` // disable, verify-full

	// goma
	IsConfig      bool   `json:"isConfig"`      // goma config generate
	Debug         bool   `json:"debug"`         // goma debug mode (default false)
	SQLRootDir    string `json:"sqlRootDir"`    // goma sql root dir path (default './sql')
	DaoRootDir    string `json:"daoRootDir"`    // goma dao root dir path (default './dao')
	EntityRootDir string `json:"entityRootDir"` // goma entity root dir path (default './entity')
	CurrentDir    string `json:"currentDir"`    // goma currentDir path
}

Options is open sql.DB options.

func NewOptions

func NewOptions(filePath string) (Options, error)

NewOptions create read file Options.

func (Options) ConfigPath

func (o Options) ConfigPath() string

ConfigPath result config path.

func (Options) DaoImportPath

func (o Options) DaoImportPath() string

DaoImportPath result dao package import.

func (Options) DaoPkgName

func (o Options) DaoPkgName() string

DaoPkgName result dao package name.

func (Options) EntityImportPath

func (o Options) EntityImportPath() string

EntityImportPath result entity package import.

func (Options) EntityPkgName

func (o Options) EntityPkgName() string

EntityPkgName result entity package name.

func (Options) SQLRootDirPath

func (o Options) SQLRootDirPath() string

SQLRootDirPath result sql dir path.

func (Options) Source

func (o Options) Source() string

Source create driver databaseSource.

func (Options) Tuples

func (o Options) Tuples() []map[string]interface{}

Tuples opions to string array map.

Directories

Path Synopsis
dao
gen
goma
Package lint contains a linter for Go source code.
Package lint contains a linter for Go source code.
test

Jump to

Keyboard shortcuts

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