(ctx context.Context, session *Session)
| 1130 | } |
| 1131 | |
| 1132 | func (s *BeginRoStatement) Execute(ctx context.Context, session *Session) (*Result, error) { |
| 1133 | if session.InReadWriteTransaction() { |
| 1134 | return nil, errors.New("You're in read-write transaction. Please finish the transaction by 'COMMIT;' or 'ROLLBACK;'") |
| 1135 | } |
| 1136 | if session.InReadOnlyTransaction() { |
| 1137 | // close current transaction implicitly |
| 1138 | close := &CloseStatement{} |
| 1139 | close.Execute(ctx, session) |
| 1140 | } |
| 1141 | |
| 1142 | ts, err := session.BeginReadOnlyTransaction(ctx, s.TimestampBoundType, s.Staleness, s.Timestamp, s.Priority, s.Tag) |
| 1143 | if err != nil { |
| 1144 | return nil, err |
| 1145 | } |
| 1146 | |
| 1147 | return &Result{ |
| 1148 | IsMutation: true, |
| 1149 | Timestamp: ts, |
| 1150 | }, nil |
| 1151 | } |
| 1152 | |
| 1153 | type CloseStatement struct{} |
| 1154 |
nothing calls this directly
no test coverage detected