MCPcopy Index your code
hub / github.com/upper/db / TestInsertVarcharPrimaryKey

Method TestInsertVarcharPrimaryKey

adapter/postgresql/postgresql_test.go:1020–1051  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1018}
1019
1020func (s *AdapterTests) TestInsertVarcharPrimaryKey() {
1021 sess := s.Session()
1022
1023 {
1024 type itemT struct {
1025 Address string `db:"address"`
1026 Name string `db:"name"`
1027 }
1028
1029 item1 := itemT{
1030 Address: "1234",
1031 Name: "Jonny",
1032 }
1033
1034 col := sess.Collection("varchar_primary_key")
1035 err := col.Truncate()
1036 s.NoError(err)
1037
1038 err = col.InsertReturning(&item1)
1039 s.NoError(err)
1040
1041 var item2 itemT
1042 err = col.Find(db.Cond{"address": item1.Address}).One(&item2)
1043 s.NoError(err)
1044 s.Equal(item1.Name, item2.Name)
1045
1046 var item3 itemT
1047 err = col.Find(db.Cond{"address": item1.Address}).One(&item3)
1048 s.NoError(err)
1049 s.Equal(item1.Name, item3.Name)
1050 }
1051}
1052
1053func (s *AdapterTests) Test_Issue409_TxOptions() {
1054 sess := s.Session()

Callers

nothing calls this directly

Calls 6

SessionMethod · 0.65
CollectionMethod · 0.65
TruncateMethod · 0.65
InsertReturningMethod · 0.65
OneMethod · 0.65
FindMethod · 0.65

Tested by

no test coverage detected