(input string)
| 1094 | } |
| 1095 | |
| 1096 | func newBeginRoStatement(input string) (*BeginRoStatement, error) { |
| 1097 | stmt := &BeginRoStatement{ |
| 1098 | TimestampBoundType: strong, |
| 1099 | } |
| 1100 | |
| 1101 | matched := beginRoRe.FindStringSubmatch(input) |
| 1102 | if matched[1] != "" { |
| 1103 | if t, err := time.Parse(time.RFC3339Nano, matched[1]); err == nil { |
| 1104 | stmt = &BeginRoStatement{ |
| 1105 | TimestampBoundType: readTimestamp, |
| 1106 | Timestamp: t, |
| 1107 | } |
| 1108 | } |
| 1109 | if i, err := strconv.Atoi(matched[1]); err == nil { |
| 1110 | stmt = &BeginRoStatement{ |
| 1111 | TimestampBoundType: exactStaleness, |
| 1112 | Staleness: time.Duration(i) * time.Second, |
| 1113 | } |
| 1114 | } |
| 1115 | } |
| 1116 | |
| 1117 | if matched[2] != "" { |
| 1118 | priority, err := parsePriority(matched[2]) |
| 1119 | if err != nil { |
| 1120 | return nil, err |
| 1121 | } |
| 1122 | stmt.Priority = priority |
| 1123 | } |
| 1124 | |
| 1125 | if matched[3] != "" { |
| 1126 | stmt.Tag = matched[3] |
| 1127 | } |
| 1128 | |
| 1129 | return stmt, nil |
| 1130 | } |
| 1131 | |
| 1132 | func (s *BeginRoStatement) Execute(ctx context.Context, session *Session) (*Result, error) { |
| 1133 | if session.InReadWriteTransaction() { |
no test coverage detected