Skip to content

Commit 2da076d

Browse files
author
ffranr
authored
Merge pull request #1420 from Roasbeef/ignore-tree-impl
tapdb+universe: implement initial version of universe ignore tree
2 parents 8a8daea + 9668caa commit 2da076d

19 files changed

+1768
-18
lines changed

asset/asset.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,18 @@ func (s *Specifier) UnwrapGroupKeyToPtr() *btcec.PublicKey {
449449
return s.groupKey.UnwrapToPtr()
450450
}
451451

452+
// UnwrapGroupKeyOrErr unwraps the group public key field or returns an error if
453+
// it is not specified.
454+
func (s *Specifier) UnwrapGroupKeyOrErr() (*btcec.PublicKey, error) {
455+
groupKey := s.groupKey.UnwrapToPtr()
456+
if groupKey == nil {
457+
return nil, fmt.Errorf("unable to unwrap asset group public " +
458+
"key")
459+
}
460+
461+
return groupKey, nil
462+
}
463+
452464
// UnwrapToPtr unwraps the asset ID and asset group public key fields,
453465
// returning them as pointers.
454466
func (s *Specifier) UnwrapToPtr() (*ID, *btcec.PublicKey) {

cmd/merge-sql-schemas/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@ func main() {
6565
//
6666
// This way, we can consolidate and export the complete database schema
6767
// as it stands after all migrations have been applied.
68+
//
69+
// We filter our where sql is NOT NULL, as for the internal sqlite
70+
// creates, the sql column will be NULL.
6871
// ---------------------------------------------------------------------
6972
rows, err := db.Query(`
7073
SELECT type, name, sql FROM sqlite_master
71-
WHERE type IN ('table','view') ORDER BY name`,
74+
WHERE type IN ('table','view', 'index') AND sql IS NOT NULL
75+
ORDER BY name`,
7276
)
7377
if err != nil {
7478
log.Fatalf("failed to query schema: %v", err)

tapdb/assets_common.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ type UpsertAssetStore interface {
5050
FetchGenesisID(ctx context.Context,
5151
arg sqlc.FetchGenesisIDParams) (int64, error)
5252

53+
// FetchGenesisIDByAssetID fetches the database ID of an asset genesis
54+
// by its asset ID.
55+
FetchGenesisIDByAssetID(ctx context.Context,
56+
assetID []byte) (int64, error)
57+
5358
// FetchScriptKeyIDByTweakedKey determines the database ID of a script
5459
// key by querying it by the tweaked key.
5560
FetchScriptKeyIDByTweakedKey(ctx context.Context,

0 commit comments

Comments
 (0)