@@ -130,8 +130,42 @@ func (p *Pool) Close() error {
130
130
return p .pool .Close ()
131
131
}
132
132
133
- // Get gets an SQLite connection from the pool.
133
+ // Get obtains an SQLite connection from the pool,
134
+ // waiting until the initial migration is complete.
135
+ // Get is identical to [Pool.Take].
136
+ //
137
+ // If no connection is available,
138
+ // Get will block until at least one connection is returned with [Pool.Put],
139
+ // or until either the Pool is closed or the context is canceled.
140
+ // If no connection can be obtained
141
+ // or an error occurs while preparing the connection,
142
+ // an error is returned.
143
+ //
144
+ // The provided context is also used to control the execution lifetime of the connection.
145
+ // See [sqlite.Conn.SetInterrupt] for details.
146
+ //
147
+ // Applications must ensure that all non-nil Conns returned from Get
148
+ // are returned to the same Pool with [Pool.Put].
134
149
func (p * Pool ) Get (ctx context.Context ) (* sqlite.Conn , error ) {
150
+ return p .Take (ctx )
151
+ }
152
+
153
+ // Take obtains an SQLite connection from the pool,
154
+ // waiting until the initial migration is complete.
155
+ //
156
+ // If no connection is available,
157
+ // Take will block until at least one connection is returned with [Pool.Put],
158
+ // or until either the Pool is closed or the context is canceled.
159
+ // If no connection can be obtained
160
+ // or an error occurs while preparing the connection,
161
+ // an error is returned.
162
+ //
163
+ // The provided context is also used to control the execution lifetime of the connection.
164
+ // See [sqlite.Conn.SetInterrupt] for details.
165
+ //
166
+ // Applications must ensure that all non-nil Conns returned from Take
167
+ // are returned to the same Pool with [Pool.Put].
168
+ func (p * Pool ) Take (ctx context.Context ) (* sqlite.Conn , error ) {
135
169
tick := time .NewTicker (5 * time .Second )
136
170
for ready := false ; ! ready ; {
137
171
// Inform Pool.open to keep trying.
0 commit comments