NewDatabaseStore creates a Store pre-populated with the given database. The returned store serves data entirely from memory and never fetches from the network or touches the filesystem, making it suitable for tests and any scenario where the provider data is already known.
(db *Database)
| 141 | // from the network or touches the filesystem, making it suitable for |
| 142 | // tests and any scenario where the provider data is already known. |
| 143 | func NewDatabaseStore(db *Database) *Store { |
| 144 | return &Store{db: db, fetch: fetchFromAPI} |
| 145 | } |
| 146 | |
| 147 | // GetDatabase returns the models.dev database, fetching from cache or API as needed. |
| 148 | func (s *Store) GetDatabase(ctx context.Context) (*Database, error) { |
no outgoing calls