Close commits any ongoing transaction if needed and closes the underlying storage.
(commit bool)
| 118 | |
| 119 | // Close commits any ongoing transaction if needed and closes the underlying storage. |
| 120 | func (s *State) Close(commit bool) (err error) { |
| 121 | s.Lock() |
| 122 | defer s.Unlock() |
| 123 | if s.closed { |
| 124 | return |
| 125 | } |
| 126 | if s.handler != nil { |
| 127 | if commit { |
| 128 | s.commitHandler() |
| 129 | } else { |
| 130 | s.rollbackHandler() |
| 131 | } |
| 132 | } |
| 133 | if err = s.strg.Close(); err != nil { |
| 134 | return |
| 135 | } |
| 136 | s.closed = true |
| 137 | return |
| 138 | } |
| 139 | |
| 140 | func buildTypeNamesFromSQLColumnTypes(types []*sql.ColumnType) (names []string) { |
| 141 | names = make([]string, len(types)) |
nothing calls this directly
no test coverage detected