Skip to content

Commit

Permalink
rename model.Model interface's Table func name, avoid conflict with sb
Browse files Browse the repository at this point in the history
  • Loading branch information
halfcrazy committed Sep 27, 2023
1 parent 754b46b commit 13b6a55
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
16 changes: 8 additions & 8 deletions cache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ type testModel struct {
Datapath *string `ovsdb:"datapath"`
}

func (t *testModel) Table() string {
func (t *testModel) TableName() string {
return "Open_vSwitch"
}

Expand Down Expand Up @@ -379,7 +379,7 @@ type testModel1 struct {
Bar map[string]string `ovsdb:"bar"`
}

func (t *testModel1) Table() string {
func (t *testModel1) TableName() string {
return "Open_vSwitch"
}

Expand Down Expand Up @@ -807,7 +807,7 @@ type testModel2 struct {
Baz string `ovsdb:"baz"`
}

func (t *testModel2) Table() string {
func (t *testModel2) TableName() string {
return "Open_vSwitch"
}

Expand Down Expand Up @@ -1058,7 +1058,7 @@ type testModel3 struct {
Bar map[string]string `ovsdb:"bar"`
}

func (t *testModel3) Table() string {
func (t *testModel3) TableName() string {
return "Open_vSwitch"
}

Expand Down Expand Up @@ -1922,7 +1922,7 @@ type badModel struct {
Baz string `ovsdb:"baz"`
}

func (b *badModel) Table() string {
func (b *badModel) TableName() string {
return "bad"
}

Expand Down Expand Up @@ -2156,7 +2156,7 @@ type testModel4 struct {
Baz map[string]string `ovsdb:"baz"`
}

func (t *testModel4) Table() string {
func (t *testModel4) TableName() string {
return "Open_vSwitch"
}

Expand Down Expand Up @@ -2331,7 +2331,7 @@ type rowsByConditionTestModel struct {
Empty string `ovsdb:"empty"`
}

func (r *rowsByConditionTestModel) Table() string {
func (r *rowsByConditionTestModel) TableName() string {
return "Open_vSwitch"
}

Expand Down Expand Up @@ -2747,7 +2747,7 @@ type testDBModel struct {
Set []string `ovsdb:"set"`
}

func (t *testDBModel) Table() string {
func (t *testDBModel) TableName() string {
return "Open_vSwitch"
}

Expand Down
2 changes: 1 addition & 1 deletion client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,7 @@ func (a api) Wait(untilConFun ovsdb.WaitCondition, timeout *int, model model.Mod
// getTableFromModel returns the table name from a Model object after performing
// type verifications on the model
func (a api) getTableFromModel(m model.Model) (string, error) {
table := m.Table()
table := m.TableName()
if table == "" {
return "", &ErrWrongType{reflect.TypeOf(m), "Model not found in Database Model"}
}
Expand Down
10 changes: 5 additions & 5 deletions client/api_test_model.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@ type testLogicalSwitch struct {
Acls []string `ovsdb:"acls"`
}

// Table returns the table name. It's part of the Model interface
func (*testLogicalSwitch) Table() string {
// TableName returns the table name. It's part of the Model interface
func (*testLogicalSwitch) TableName() string {
return "Logical_Switch"
}

//LogicalSwitchPort struct defines an object in Logical_Switch_Port table
// LogicalSwitchPort struct defines an object in Logical_Switch_Port table
type testLogicalSwitchPort struct {
UUID string `ovsdb:"_uuid"`
Up *bool `ovsdb:"up"`
Expand All @@ -148,8 +148,8 @@ type testLogicalSwitchPort struct {
ParentName *string `ovsdb:"parent_name"`
}

// Table returns the table name. It's part of the Model interface
func (*testLogicalSwitchPort) Table() string {
// TableName returns the table name. It's part of the Model interface
func (*testLogicalSwitchPort) TableName() string {
return "Logical_Switch_Port"
}

Expand Down
4 changes: 2 additions & 2 deletions client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type Bridge struct {
STPEnable bool `ovsdb:"stp_enable"`
}

func (b *Bridge) Table() string {
func (b *Bridge) TableName() string {
return "Bridge"
}

Expand All @@ -107,7 +107,7 @@ type OpenvSwitch struct {
SystemVersion *string `ovsdb:"system_version"`
}

func (o *OpenvSwitch) Table() string {
func (o *OpenvSwitch) TableName() string {
return "Open_vSwitch"
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/stress/stress.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type bridgeType struct {
Status map[string]string `ovsdb:"status"`
}

func (b *bridgeType) Table() string {
func (b *bridgeType) TableName() string {
return "Bridge"
}

Expand All @@ -39,7 +39,7 @@ type ovsType struct {
Bridges []string `ovsdb:"bridges"`
}

func (o *ovsType) Table() string {
func (o *ovsType) TableName() string {
return "Open_vSwitch"
}

Expand Down
2 changes: 1 addition & 1 deletion model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// LoadBalancers []string `ovsdb:"load_balancer"`
// }
type Model interface {
Table() string
TableName() string
}

type CloneableModel interface {
Expand Down
8 changes: 4 additions & 4 deletions model/model_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type modelA struct {
UUID string `ovsdb:"_uuid"`
}

func (m *modelA) Table() string {
func (m *modelA) TableName() string {
return "A"
}

Expand All @@ -24,15 +24,15 @@ type modelB struct {
Bar string `ovsdb:"baz"`
}

func (m *modelB) Table() string {
func (m *modelB) TableName() string {
return "B"
}

type modelInvalid struct {
Foo string
}

func (m *modelInvalid) Table() string {
func (m *modelInvalid) TableName() string {
return "Invalid"
}

Expand Down Expand Up @@ -107,7 +107,7 @@ type testTable struct {
AMap map[string]string `ovsdb:"aMap"`
}

func (t *testTable) Table() string {
func (t *testTable) TableName() string {
return "TestTable"
}

Expand Down
2 changes: 1 addition & 1 deletion modelgen/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ type {{ index . "StructName" }} struct {
{{ end }}
{{ template "extraFields" . }}
}
func (a *{{ index . "StructName" }}) Table() string {
func (a *{{ index . "StructName" }}) TableName() string {
return {{ index . "StructName" }}Table
}
{{ template "postStructDefinitions" . }}
Expand Down
14 changes: 7 additions & 7 deletions modelgen/table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ type AtomicTable struct {
Str string ` + "`" + `ovsdb:"str"` + "`" + `
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
`,
Expand All @@ -108,7 +108,7 @@ type AtomicTable struct {
Str string ` + "`" + `ovsdb:"str"` + "`" + `
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
`,
Expand Down Expand Up @@ -160,7 +160,7 @@ type AtomicTable struct {
OtherStr string
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
`,
Expand Down Expand Up @@ -201,7 +201,7 @@ type AtomicTable struct {
Str string ` + "`" + `ovsdb:"str"` + "`" + `
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
Expand Down Expand Up @@ -370,7 +370,7 @@ type AtomicTable struct {
OtherStr string
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
Expand Down Expand Up @@ -503,7 +503,7 @@ type AtomicTable struct {
Str string ` + "`" + `ovsdb:"str"` + "`" + `
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
Expand Down Expand Up @@ -630,7 +630,7 @@ type AtomicTable struct {
Str string ` + "`" + `ovsdb:"str"` + "`" + `
}
func (a *AtomicTable) Table() string {
func (a *AtomicTable) TableName() string {
return AtomicTableTable
}
Expand Down
2 changes: 1 addition & 1 deletion ovsdb/serverdb/database.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions test/ovs/ovs_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ type bridgeType struct {
DatapathID *string `ovsdb:"datapath_id"`
}

func (b *bridgeType) Table() string {
func (b *bridgeType) TableName() string {
return "Bridge"
}

Expand All @@ -192,7 +192,7 @@ type ovsType struct {
SystemVersion *string `ovsdb:"system_version"`
}

func (o *ovsType) Table() string {
func (o *ovsType) TableName() string {
return "Open_vSwitch"
}

Expand All @@ -202,7 +202,7 @@ type ipfixType struct {
Targets []string `ovsdb:"targets"`
}

func (i *ipfixType) Table() string {
func (i *ipfixType) TableName() string {
return "IPFIX"
}

Expand All @@ -212,7 +212,7 @@ type queueType struct {
DSCP *int `ovsdb:"dscp"`
}

func (q *queueType) Table() string {
func (q *queueType) TableName() string {
return "Queue"
}

Expand Down
6 changes: 3 additions & 3 deletions test/test_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ type BridgeType struct {
Status map[string]string `ovsdb:"status"`
}

func (b *BridgeType) Table() string {
func (b *BridgeType) TableName() string {
return "Bridge"
}

Expand All @@ -154,7 +154,7 @@ type OvsType struct {
Bridges []string `ovsdb:"bridges"`
}

func (o *OvsType) Table() string {
func (o *OvsType) TableName() string {
return "Open_vSwitch"
}

Expand All @@ -166,7 +166,7 @@ type FlowSampleCollectorSetType struct {
IPFIX *string // `ovsdb:"ipfix"`
}

func (f *FlowSampleCollectorSetType) Table() string {
func (f *FlowSampleCollectorSetType) TableName() string {
return "FlowSampleCollectorSet"
}

Expand Down

0 comments on commit 13b6a55

Please sign in to comment.