package graphdb import ( "github.com/lightningnetwork/lnd/sqldb" ) // SQLQueries is a subset of the sqlc.Querier interface that can be used to // execute queries against the SQL graph tables. type SQLQueries interface { } // BatchedSQLQueries is a version of SQLQueries that's capable of batched // database operations. type BatchedSQLQueries interface { SQLQueries sqldb.BatchedTx[SQLQueries] } // SQLStore is an implementation of the V1Store interface that uses a SQL // database as the backend. // // NOTE: currently, this temporarily embeds the KVStore struct so that we can // implement the V1Store interface incrementally. For any method not // implemented, things will fall back to the KVStore. This is ONLY the case // for the time being while this struct is purely used in unit tests only. type SQLStore struct { db BatchedSQLQueries // Temporary fall-back to the KVStore so that we can implement the // interface incrementally. *KVStore } // A compile-time assertion to ensure that SQLStore implements the V1Store // interface. var _ V1Store = (*SQLStore)(nil) // NewSQLStore creates a new SQLStore instance given an open BatchedSQLQueries // storage backend. func NewSQLStore(db BatchedSQLQueries, kvStore *KVStore) *SQLStore { return &SQLStore{ db: db, KVStore: kvStore, } }