Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9d03bc8e16 | |||
| b169659e02 |
2
go.mod
2
go.mod
@@ -1,3 +1,3 @@
|
|||||||
module manabox.cn/tdengine-mapper
|
module codeup.manabox.cn/public/tdengine-mapper-go
|
||||||
|
|
||||||
go 1.18
|
go 1.18
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package td_builder
|
package tmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
package td_builder
|
package tmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"manabox.cn/tdengine-mapper/syncmap"
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewTdMapping() *TdMapping {
|
func NewMapping() *TdMapping {
|
||||||
return &TdMapping{}
|
return &TdMapping{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -17,7 +16,7 @@ type TableNamer interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TdMapping struct {
|
type TdMapping struct {
|
||||||
modelMates syncmap.Map[string, *StructMate]
|
modelMates Map[string, *StructMate]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *TdMapping) scanStruct(data ...any) error {
|
func (b *TdMapping) scanStruct(data ...any) error {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package td_builder
|
package tmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
@@ -49,7 +49,7 @@ func (s *TaosUser) TableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestBuilderInsert(t *testing.T) {
|
func TestBuilderInsert(t *testing.T) {
|
||||||
tdMapping := NewTdMapping()
|
tdMapping := NewMapping()
|
||||||
p := 1
|
p := 1
|
||||||
data := []any{
|
data := []any{
|
||||||
&TaosDevice{
|
&TaosDevice{
|
||||||
@@ -113,7 +113,7 @@ func (u *User) SuperTableName() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSimpleInsert(t *testing.T) {
|
func TestSimpleInsert(t *testing.T) {
|
||||||
tdMapping := NewTdMapping()
|
tdMapping := NewMapping()
|
||||||
data := []any{
|
data := []any{
|
||||||
&User{Name: "张三", Age: 18},
|
&User{Name: "张三", Age: 18},
|
||||||
&User{Name: "李四", Age: 20},
|
&User{Name: "李四", Age: 20},
|
||||||
|
|||||||
2
scan.go
2
scan.go
@@ -1,4 +1,4 @@
|
|||||||
package td_builder
|
package tmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package syncmap
|
package tmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package syncmap
|
package tmapping
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
Reference in New Issue
Block a user