Documentation ¶
Overview ¶
Copyright 2021 SANGFOR TECHNOLOGIES
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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.
Copyright 2021 SANGFOR TECHNOLOGIES ¶
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 ¶
- func ExecDBWrite(f func() error) (err error)
- func ExecMultiSQL(multiSQL *dtstruct.MultiSQL) (err error)
- func ExecSQL(query string, args ...interface{}) (result sql.Result, err error)
- func GetDBClient() (db *sql.DB, err error)
- func Query(query string, argsArray []interface{}, funcOnRow func(sqlutil.RowMap) error) (err error)
- func QueryBuffered(query string, argsArray []interface{}, funcOnRow func(sqlutil.RowMap) error) (err error)
- type BackendDBHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecDBWrite ¶
ExecDBWrite backpressure database write
func ExecMultiSQL ¶
ExecMultiSQL exec multi sql in one transaction.
func GetDBClient ¶
GetDBClient get backend db client from cache or create it if not exist in cache.
Types ¶
type BackendDBHandler ¶
type BackendDBHandler interface { // DBHandler get db client connected backend db to process crud, if err is not nil, db should be nil DBHandler() (db *sql.DB, err error) // CreateDatabase create database specified in config CreateDatabase() error // DeployCheck check if given version has already been deployed // return true means continue to deploy DeployCheck() (string, bool) // SchemaInit init all schema and apply patch ddl SchemaInit(schema []string) // StatementDialect refactor statement using dialect StatementDialect(statement string) (string, error) // Config config database using option param Config(option map[string]interface{}) }
BackendDBHandler interface to adapt different backend database
func GetBackendDBHandler ¶
func GetBackendDBHandler(dbType string) BackendDBHandler
GetBackendDBHandler return backend db handler according to database type
Directories ¶
Path | Synopsis |
---|---|
Copyright 2021 SANGFOR TECHNOLOGIES
|
Copyright 2021 SANGFOR TECHNOLOGIES |
mysql
Copyright 2021 SANGFOR TECHNOLOGIES
|
Copyright 2021 SANGFOR TECHNOLOGIES |
sqlite
Copyright 2021 SANGFOR TECHNOLOGIES
|
Copyright 2021 SANGFOR TECHNOLOGIES |
testdb
Copyright 2021 SANGFOR TECHNOLOGIES
|
Copyright 2021 SANGFOR TECHNOLOGIES |
copyright 2017 shlomi noach, github inc.
|
copyright 2017 shlomi noach, github inc. |