model

package
v0.0.0-...-216fba0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2016 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

This package defined and implemented databases model. There have three interface:

interface_db.go
interface_builder.go
interface_model.go

The DB interface defined database connection, query and transaction functions.

The BuilderInterface defined how to generate sql statement and get the results.

The ModelInterface defined orm functions.

And now only support MySQL database, if you want to use another database, you can implement the three interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuilderWraperInterface

type BuilderWraperInterface interface {
	Select(columns ...string) ModelInterface
	From(tableName string) ModelInterface
	Where(columnName, operation, value string) ModelInterface
	Get() map[string]string
}

type Model

type Model struct {
	ModelInterface // implements ModelInterface
	// contains filtered or unexported fields
}

func (*Model) Builder

func (m *Model) Builder() SQLBuilder.BuilderInterface

func (*Model) SetBuilder

func (m *Model) SetBuilder(b SQLBuilder.BuilderInterface)

type ModelInterface

type ModelInterface interface {

	// orm functions
	Insert(interface{}) (int64, error) // Save struct data
	MultiInsert(...interface{}) ([]int64, error)

	// builder
	SetBuilder(SQLBuilder.BuilderInterface)
	Builder() SQLBuilder.BuilderInterface

	// transaction
	TransactionStart() error
	TransactionCommit() error
	TransactionRollback() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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