Quentin Smith | 8b9eb18 | 2017-01-05 11:01:47 -0500 | [diff] [blame] | 1 | // Copyright 2017 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package db |
| 6 | |
Quentin Smith | 4b02898 | 2017-01-14 23:21:11 -0500 | [diff] [blame] | 7 | import ( |
| 8 | "database/sql" |
| 9 | "time" |
| 10 | ) |
Quentin Smith | 8b9eb18 | 2017-01-05 11:01:47 -0500 | [diff] [blame] | 11 | |
Quentin Smith | 8b9eb18 | 2017-01-05 11:01:47 -0500 | [diff] [blame] | 12 | func DBSQL(db *DB) *sql.DB { |
| 13 | return db.sql |
| 14 | } |
Quentin Smith | 4b02898 | 2017-01-14 23:21:11 -0500 | [diff] [blame] | 15 | |
| 16 | func SetNow(t time.Time) { |
| 17 | if t.IsZero() { |
| 18 | now = time.Now |
| 19 | return |
| 20 | } |
| 21 | now = func() time.Time { return t } |
| 22 | } |