Skip to content

Commit

Permalink
Remove sneak peek and add compile-time interface conformity checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaptic committed Aug 5, 2022
1 parent e4a864f commit 3097448
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
15 changes: 6 additions & 9 deletions exp/lighthorizon/services/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,16 @@ import (
"github.com/stellar/go/xdr"
)

type OperationsService struct {
OperationsRepository
Config Config
}

type OperationsRepository interface {
GetOperationsByAccount(ctx context.Context,
cursor int64, limit uint64,
accountId string,
) ([]common.Operation, error)
}

GetPaymentsByAccount(ctx context.Context,
cursor int64, limit uint64,
accountId string,
) ([]common.Operation, error)
type OperationsService struct {
OperationsRepository
Config Config
}

func (os *OperationsService) GetOperationsByAccount(ctx context.Context,
Expand Down Expand Up @@ -91,3 +86,5 @@ func operationsResponseAgeSeconds(ops []common.Operation) float64 {
}
return now.Sub(lastCloseTime).Seconds()
}

var _ OperationsRepository = (*OperationsService)(nil) // ensure conformity to the interface
2 changes: 2 additions & 0 deletions exp/lighthorizon/services/transactions.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,5 @@ func transactionsResponseAgeSeconds(txs []common.Transaction) float64 {
}
return now.Sub(lastCloseTime).Seconds()
}

var _ TransactionRepository = (*TransactionsService)(nil) // ensure conformity to the interface

0 comments on commit 3097448

Please sign in to comment.