forked from apache/incubator-seata-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat:add mysql table meta func && sql addEscape, delEscape func issue… (
apache#294) * feat:add mysql table meta func && sql addEscape, delEscape func issue#290 * fix:TestMetaCache func rename * fix:ci lint fail fix * fix: solve GetTableMeta return type && constant define * fix:solve code format and meta cache func fault * fix:solev git ci fail * fix:solev git ci fail * format:format code * fix:merge master && format code * fix:solve name conflict Co-authored-by: 王瑞 <[email protected]> Co-authored-by: wangrui130 <[email protected]>
- Loading branch information
1 parent
15d6a1a
commit eadf8bf
Showing
17 changed files
with
1,021 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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. | ||
*/ | ||
|
||
package mysql | ||
|
||
import ( | ||
"context" | ||
"database/sql" | ||
_ "github.com/go-sql-driver/mysql" | ||
"gotest.tools/assert" | ||
"testing" | ||
) | ||
|
||
// TestGetTableMeta | ||
func TestGetTableMeta(t *testing.T) { | ||
// local test can annotation t.SkipNow() | ||
t.SkipNow() | ||
|
||
testTableMeta := func() { | ||
metaInstance := GetTableMetaInstance() | ||
|
||
db, err := sql.Open("mysql", "root:123456@tcp(127.0.0.1:3306)/seata?multiStatements=true") | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
defer db.Close() | ||
|
||
ctx := context.Background() | ||
conn, _ := db.Conn(ctx) | ||
|
||
tableMeta, err := metaInstance.GetTableMeta(ctx, "undo_log", conn) | ||
assert.NilError(t, err) | ||
|
||
t.Logf("%+v", tableMeta) | ||
} | ||
|
||
t.Run("testTableMeta", func(t *testing.T) { | ||
testTableMeta() | ||
}) | ||
} |
Oops, something went wrong.