Documentation ¶
Overview ¶
Copyright 2017 by GoSpider author. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func NewMysqlUrl(c DbConfig) string
- func NewPqUrl(c DbConfig) string
- type DbConfig
- type MyDb
- func (db *MyDb) CreateTables(beanOrTableName interface{}) error
- func (db *MyDb) Delete(bean interface{}) (int64, error)
- func (db *MyDb) DropTables(beans ...interface{}) error
- func (db *MyDb) Exec(sql string, args ...interface{}) (sql.Result, error)
- func (db *MyDb) Insert(beans ...interface{}) (int64, error)
- func (db *MyDb) InsertOne(beans interface{}) (int64, error)
- func (db *MyDb) IsTableExist(beanOrTableName interface{}) (bool, error)
- func (db *MyDb) Ping() error
- func (db *MyDb) Query(sql string, paramStr ...interface{}) (resultsSlice []map[string][]byte, err error)
- func (db *MyDb) Update(bean interface{}, condiBean ...interface{}) (int64, error)
- type MyDbConfig
Constants ¶
View Source
const ( PG = "postgres" MYSQL = "mysql" )
Variables ¶
This section is empty.
Functions ¶
func NewMysqlUrl ¶
Types ¶
type MyDb ¶
type MyDb struct { Config MyDbConfig Client *xorm.Engine }
func NewDb ¶
func NewDb(config MyDbConfig) (*MyDb, error)
func (*MyDb) CreateTables ¶
func (*MyDb) DropTables ¶
func (*MyDb) Exec ¶
sql = "update `userinfo` set username=? where id=?" res, err := engine.Exec(sql, "xiaolun", 1)
func (*MyDb) IsTableExist ¶
Click to show internal directories.
Click to hide internal directories.