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

Method Test_Issue409_TxOptions

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

Source from the content-addressed store, hash-verified

1051}
1052
1053func (s *AdapterTests) Test_Issue409_TxOptions() {
1054 sess := s.Session()
1055
1056 {
1057 err := sess.TxContext(context.Background(), func(tx db.Session) error {
1058 col := tx.Collection("publication")
1059
1060 row := map[string]interface{}{
1061 "title": "foo",
1062 "author_id": 1,
1063 }
1064 err := col.InsertReturning(&row)
1065 s.Error(err)
1066
1067 return err
1068 }, &sql.TxOptions{
1069 ReadOnly: true,
1070 })
1071 s.Error(err)
1072 s.True(strings.Contains(err.Error(), "read-only transaction"))
1073 }
1074}
1075
1076func (s *AdapterTests) TestEscapeQuestionMark() {
1077 sess := s.Session()

Callers

nothing calls this directly

Calls 5

SessionMethod · 0.65
TxContextMethod · 0.65
CollectionMethod · 0.65
InsertReturningMethod · 0.65
ErrorMethod · 0.65

Tested by

no test coverage detected