GetLastValue returns the value most recently obtained by nextval() for the last sequence for which RecordLatestVal() was called.
()
| 66 | // GetLastValue returns the value most recently obtained by |
| 67 | // nextval() for the last sequence for which RecordLatestVal() was called. |
| 68 | func (ss *SequenceState) GetLastValue() (int64, error) { |
| 69 | ss.mu.Lock() |
| 70 | defer ss.mu.Unlock() |
| 71 | |
| 72 | if !ss.nextValEverCalledLocked() { |
| 73 | return 0, pgerror.New( |
| 74 | pgcode.ObjectNotInPrerequisiteState, "lastval is not yet defined in this session") |
| 75 | } |
| 76 | |
| 77 | return ss.mu.latestValues[ss.mu.lastSequenceIncremented], nil |
| 78 | } |
| 79 | |
| 80 | // GetLastValueByID returns the value most recently obtained by nextval() for |
| 81 | // the given sequence in this session. |
nothing calls this directly
no test coverage detected