Documentation ¶
Overview ¶
Package grant is a generated GoMock package.
Index ¶
- func NewPostgres() (Datastore, ReadOnlyDatastore, error)
- type ByExpiryTimestamp
- type Datastore
- type DatastoreWithPrometheus
- func (_d DatastoreWithPrometheus) GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) (ga1 []Grant, err error)
- func (_d DatastoreWithPrometheus) Migrate() (err error)
- func (_d DatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
- func (_d DatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
- func (_d DatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
- func (_d DatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
- type Grant
- type MockDatastore
- func (m *MockDatastore) EXPECT() *MockDatastoreMockRecorder
- func (m *MockDatastore) GetGrantsOrderedByExpiry(wallet wallet.Info, promotionType string) ([]Grant, error)
- func (m *MockDatastore) Migrate() error
- func (m *MockDatastore) NewMigrate() (*v4.Migrate, error)
- func (m *MockDatastore) RawDB() *sqlx.DB
- func (m *MockDatastore) RollbackTx(tx *sqlx.Tx)
- func (m *MockDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
- type MockDatastoreMockRecorder
- func (mr *MockDatastoreMockRecorder) GetGrantsOrderedByExpiry(wallet, promotionType interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) Migrate() *gomock.Call
- func (mr *MockDatastoreMockRecorder) NewMigrate() *gomock.Call
- func (mr *MockDatastoreMockRecorder) RawDB() *gomock.Call
- func (mr *MockDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
- func (mr *MockDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
- type MockReadOnlyDatastore
- func (m *MockReadOnlyDatastore) EXPECT() *MockReadOnlyDatastoreMockRecorder
- func (m *MockReadOnlyDatastore) GetGrantsOrderedByExpiry(wallet wallet.Info, promotionType string) ([]Grant, error)
- func (m *MockReadOnlyDatastore) Migrate() error
- func (m *MockReadOnlyDatastore) NewMigrate() (*v4.Migrate, error)
- func (m *MockReadOnlyDatastore) RawDB() *sqlx.DB
- func (m *MockReadOnlyDatastore) RollbackTx(tx *sqlx.Tx)
- func (m *MockReadOnlyDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
- type MockReadOnlyDatastoreMockRecorder
- func (mr *MockReadOnlyDatastoreMockRecorder) GetGrantsOrderedByExpiry(wallet, promotionType interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) Migrate() *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) NewMigrate() *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) RawDB() *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
- func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
- type Postgres
- type ReadOnlyDatastore
- type ReadOnlyDatastoreWithPrometheus
- func (_d ReadOnlyDatastoreWithPrometheus) GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) (ga1 []Grant, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) Migrate() (err error)
- func (_d ReadOnlyDatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
- func (_d ReadOnlyDatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
- func (_d ReadOnlyDatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
- func (_d ReadOnlyDatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
- type Service
- func (s *Service) Collect(ch chan<- prometheus.Metric)
- func (s *Service) Describe(ch chan<- *prometheus.Desc)
- func (service *Service) GetGrantsOrderedByExpiry(wallet wallet.Info, promotionType string) ([]Grant, error)
- func (s *Service) Jobs() []srv.Job
- func (s *Service) ReadableDatastore() ReadOnlyDatastore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPostgres ¶ added in v0.1.2
func NewPostgres() (Datastore, ReadOnlyDatastore, error)
NewPostgres creates postgres connections
Types ¶
type ByExpiryTimestamp ¶ added in v0.1.1
type ByExpiryTimestamp []Grant
ByExpiryTimestamp implements sort.Interface for []Grant based on the ExpiryTimestamp field.
func (ByExpiryTimestamp) Len ¶ added in v0.1.1
func (a ByExpiryTimestamp) Len() int
func (ByExpiryTimestamp) Less ¶ added in v0.1.1
func (a ByExpiryTimestamp) Less(i, j int) bool
func (ByExpiryTimestamp) Swap ¶ added in v0.1.1
func (a ByExpiryTimestamp) Swap(i, j int)
type Datastore ¶ added in v0.1.2
type Datastore interface { grantserver.Datastore // GetGrantsOrderedByExpiry returns ordered grant claims with optional promotion type filter GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) ([]Grant, error) }
Datastore abstracts over the underlying datastore
type DatastoreWithPrometheus ¶ added in v0.3.0
type DatastoreWithPrometheus struct {
// contains filtered or unexported fields
}
DatastoreWithPrometheus implements Datastore interface with all methods wrapped with Prometheus metrics
func NewDatastoreWithPrometheus ¶ added in v0.3.0
func NewDatastoreWithPrometheus(base Datastore, instanceName string) DatastoreWithPrometheus
NewDatastoreWithPrometheus returns an instance of the Datastore decorated with prometheus summary metric
func (DatastoreWithPrometheus) GetGrantsOrderedByExpiry ¶ added in v0.3.0
func (_d DatastoreWithPrometheus) GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) (ga1 []Grant, err error)
GetGrantsOrderedByExpiry implements Datastore
func (DatastoreWithPrometheus) Migrate ¶ added in v0.3.0
func (_d DatastoreWithPrometheus) Migrate() (err error)
Migrate implements Datastore
func (DatastoreWithPrometheus) NewMigrate ¶ added in v0.3.0
func (_d DatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
NewMigrate implements Datastore
func (DatastoreWithPrometheus) RawDB ¶ added in v0.3.0
func (_d DatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
RawDB implements Datastore
func (DatastoreWithPrometheus) RollbackTx ¶ added in v0.3.0
func (_d DatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
RollbackTx implements Datastore
func (DatastoreWithPrometheus) RollbackTxAndHandle ¶ added in v0.4.0
func (_d DatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
RollbackTxAndHandle implements Datastore
type Grant ¶
type Grant struct { AltCurrency *altcurrency.AltCurrency `json:"altcurrency" valid:"-"` GrantID uuid.UUID `json:"grantId" valid:"-" db:"id"` Probi decimal.Decimal `json:"probi" valid:"-"` PromotionID uuid.UUID `json:"promotionId" valid:"-" db:"promotion_id"` MaturityTimestamp int64 `json:"maturityTime" valid:"-"` ExpiryTimestamp int64 `json:"expiryTime" valid:"-"` Type string `json:"type,omitempty" valid:"-" db:"promotion_type"` ProviderID *uuid.UUID `json:"providerId,omitempty" valid:"-"` }
Grant - a "check" good for the amount inscribed, redeemable between maturityTime and expiryTime
type MockDatastore ¶ added in v0.2.0
type MockDatastore struct {
// contains filtered or unexported fields
}
MockDatastore is a mock of Datastore interface
func NewMockDatastore ¶ added in v0.2.0
func NewMockDatastore(ctrl *gomock.Controller) *MockDatastore
NewMockDatastore creates a new mock instance
func (*MockDatastore) EXPECT ¶ added in v0.2.0
func (m *MockDatastore) EXPECT() *MockDatastoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockDatastore) GetGrantsOrderedByExpiry ¶ added in v0.2.0
func (m *MockDatastore) GetGrantsOrderedByExpiry(wallet wallet.Info, promotionType string) ([]Grant, error)
GetGrantsOrderedByExpiry mocks base method
func (*MockDatastore) Migrate ¶ added in v0.3.0
func (m *MockDatastore) Migrate() error
Migrate mocks base method
func (*MockDatastore) NewMigrate ¶ added in v0.3.0
func (m *MockDatastore) NewMigrate() (*v4.Migrate, error)
NewMigrate mocks base method
func (*MockDatastore) RawDB ¶ added in v0.3.0
func (m *MockDatastore) RawDB() *sqlx.DB
RawDB mocks base method
func (*MockDatastore) RollbackTx ¶ added in v0.3.0
func (m *MockDatastore) RollbackTx(tx *sqlx.Tx)
RollbackTx mocks base method
func (*MockDatastore) RollbackTxAndHandle ¶ added in v0.4.0
func (m *MockDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
RollbackTxAndHandle mocks base method
type MockDatastoreMockRecorder ¶ added in v0.2.0
type MockDatastoreMockRecorder struct {
// contains filtered or unexported fields
}
MockDatastoreMockRecorder is the mock recorder for MockDatastore
func (*MockDatastoreMockRecorder) GetGrantsOrderedByExpiry ¶ added in v0.2.0
func (mr *MockDatastoreMockRecorder) GetGrantsOrderedByExpiry(wallet, promotionType interface{}) *gomock.Call
GetGrantsOrderedByExpiry indicates an expected call of GetGrantsOrderedByExpiry
func (*MockDatastoreMockRecorder) Migrate ¶ added in v0.3.0
func (mr *MockDatastoreMockRecorder) Migrate() *gomock.Call
Migrate indicates an expected call of Migrate
func (*MockDatastoreMockRecorder) NewMigrate ¶ added in v0.3.0
func (mr *MockDatastoreMockRecorder) NewMigrate() *gomock.Call
NewMigrate indicates an expected call of NewMigrate
func (*MockDatastoreMockRecorder) RawDB ¶ added in v0.3.0
func (mr *MockDatastoreMockRecorder) RawDB() *gomock.Call
RawDB indicates an expected call of RawDB
func (*MockDatastoreMockRecorder) RollbackTx ¶ added in v0.3.0
func (mr *MockDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
RollbackTx indicates an expected call of RollbackTx
func (*MockDatastoreMockRecorder) RollbackTxAndHandle ¶ added in v0.4.0
func (mr *MockDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
RollbackTxAndHandle indicates an expected call of RollbackTxAndHandle
type MockReadOnlyDatastore ¶ added in v0.4.0
type MockReadOnlyDatastore struct {
// contains filtered or unexported fields
}
MockReadOnlyDatastore is a mock of ReadOnlyDatastore interface
func NewMockReadOnlyDatastore ¶ added in v0.4.0
func NewMockReadOnlyDatastore(ctrl *gomock.Controller) *MockReadOnlyDatastore
NewMockReadOnlyDatastore creates a new mock instance
func (*MockReadOnlyDatastore) EXPECT ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) EXPECT() *MockReadOnlyDatastoreMockRecorder
EXPECT returns an object that allows the caller to indicate expected use
func (*MockReadOnlyDatastore) GetGrantsOrderedByExpiry ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) GetGrantsOrderedByExpiry(wallet wallet.Info, promotionType string) ([]Grant, error)
GetGrantsOrderedByExpiry mocks base method
func (*MockReadOnlyDatastore) Migrate ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) Migrate() error
Migrate mocks base method
func (*MockReadOnlyDatastore) NewMigrate ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) NewMigrate() (*v4.Migrate, error)
NewMigrate mocks base method
func (*MockReadOnlyDatastore) RawDB ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) RawDB() *sqlx.DB
RawDB mocks base method
func (*MockReadOnlyDatastore) RollbackTx ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) RollbackTx(tx *sqlx.Tx)
RollbackTx mocks base method
func (*MockReadOnlyDatastore) RollbackTxAndHandle ¶ added in v0.4.0
func (m *MockReadOnlyDatastore) RollbackTxAndHandle(tx *sqlx.Tx) error
RollbackTxAndHandle mocks base method
type MockReadOnlyDatastoreMockRecorder ¶ added in v0.4.0
type MockReadOnlyDatastoreMockRecorder struct {
// contains filtered or unexported fields
}
MockReadOnlyDatastoreMockRecorder is the mock recorder for MockReadOnlyDatastore
func (*MockReadOnlyDatastoreMockRecorder) GetGrantsOrderedByExpiry ¶ added in v0.4.0
func (mr *MockReadOnlyDatastoreMockRecorder) GetGrantsOrderedByExpiry(wallet, promotionType interface{}) *gomock.Call
GetGrantsOrderedByExpiry indicates an expected call of GetGrantsOrderedByExpiry
func (*MockReadOnlyDatastoreMockRecorder) Migrate ¶ added in v0.4.0
func (mr *MockReadOnlyDatastoreMockRecorder) Migrate() *gomock.Call
Migrate indicates an expected call of Migrate
func (*MockReadOnlyDatastoreMockRecorder) NewMigrate ¶ added in v0.4.0
func (mr *MockReadOnlyDatastoreMockRecorder) NewMigrate() *gomock.Call
NewMigrate indicates an expected call of NewMigrate
func (*MockReadOnlyDatastoreMockRecorder) RawDB ¶ added in v0.4.0
func (mr *MockReadOnlyDatastoreMockRecorder) RawDB() *gomock.Call
RawDB indicates an expected call of RawDB
func (*MockReadOnlyDatastoreMockRecorder) RollbackTx ¶ added in v0.4.0
func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTx(tx interface{}) *gomock.Call
RollbackTx indicates an expected call of RollbackTx
func (*MockReadOnlyDatastoreMockRecorder) RollbackTxAndHandle ¶ added in v0.4.0
func (mr *MockReadOnlyDatastoreMockRecorder) RollbackTxAndHandle(tx interface{}) *gomock.Call
RollbackTxAndHandle indicates an expected call of RollbackTxAndHandle
type Postgres ¶ added in v0.1.2
type Postgres struct {
grantserver.Postgres
}
Postgres is a Datastore wrapper around a postgres database
func (*Postgres) GetGrantsOrderedByExpiry ¶ added in v0.2.0
func (pg *Postgres) GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) ([]Grant, error)
GetGrantsOrderedByExpiry returns ordered grant claims for a wallet
type ReadOnlyDatastore ¶ added in v0.2.0
type ReadOnlyDatastore interface { grantserver.Datastore // GetGrantsOrderedByExpiry returns ordered grant claims with optional promotion type filter GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) ([]Grant, error) }
ReadOnlyDatastore includes all database methods that can be made with a read only db connection
type ReadOnlyDatastoreWithPrometheus ¶ added in v0.3.0
type ReadOnlyDatastoreWithPrometheus struct {
// contains filtered or unexported fields
}
ReadOnlyDatastoreWithPrometheus implements ReadOnlyDatastore interface with all methods wrapped with Prometheus metrics
func NewReadOnlyDatastoreWithPrometheus ¶ added in v0.3.0
func NewReadOnlyDatastoreWithPrometheus(base ReadOnlyDatastore, instanceName string) ReadOnlyDatastoreWithPrometheus
NewReadOnlyDatastoreWithPrometheus returns an instance of the ReadOnlyDatastore decorated with prometheus summary metric
func (ReadOnlyDatastoreWithPrometheus) GetGrantsOrderedByExpiry ¶ added in v0.3.0
func (_d ReadOnlyDatastoreWithPrometheus) GetGrantsOrderedByExpiry(wallet walletutils.Info, promotionType string) (ga1 []Grant, err error)
GetGrantsOrderedByExpiry implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) Migrate ¶ added in v0.3.0
func (_d ReadOnlyDatastoreWithPrometheus) Migrate() (err error)
Migrate implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) NewMigrate ¶ added in v0.3.0
func (_d ReadOnlyDatastoreWithPrometheus) NewMigrate() (mp1 *migrate.Migrate, err error)
NewMigrate implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) RawDB ¶ added in v0.3.0
func (_d ReadOnlyDatastoreWithPrometheus) RawDB() (dp1 *sqlx.DB)
RawDB implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) RollbackTx ¶ added in v0.3.0
func (_d ReadOnlyDatastoreWithPrometheus) RollbackTx(tx *sqlx.Tx)
RollbackTx implements ReadOnlyDatastore
func (ReadOnlyDatastoreWithPrometheus) RollbackTxAndHandle ¶ added in v0.4.0
func (_d ReadOnlyDatastoreWithPrometheus) RollbackTxAndHandle(tx *sqlx.Tx) (err error)
RollbackTxAndHandle implements ReadOnlyDatastore
type Service ¶ added in v0.1.2
type Service struct { Datastore Datastore RoDatastore ReadOnlyDatastore // contains filtered or unexported fields }
Service contains datastore as well as prometheus metrics
func InitService ¶ added in v0.1.2
func InitService( ctx context.Context, datastore Datastore, roDatastore ReadOnlyDatastore, walletService *wallet.Service, promotionService *promotion.Service, ) (*Service, error)
InitService initializes the grant service
func (*Service) Collect ¶ added in v0.1.2
func (s *Service) Collect(ch chan<- prometheus.Metric)
Collect returns the current state of all metrics of the collector. We implement this and the Describe function to fulfill the prometheus.Collector interface
func (*Service) Describe ¶ added in v0.1.2
func (s *Service) Describe(ch chan<- *prometheus.Desc)
Describe returns all descriptions of the collector. We implement this and the Collect function to fulfill the prometheus.Collector interface
func (*Service) GetGrantsOrderedByExpiry ¶ added in v0.2.0
func (service *Service) GetGrantsOrderedByExpiry(wallet wallet.Info, promotionType string) ([]Grant, error)
GetGrantsOrderedByExpiry returns ordered grant claims for a wallet with optional promotionType filter
func (*Service) ReadableDatastore ¶ added in v0.2.0
func (s *Service) ReadableDatastore() ReadOnlyDatastore
ReadableDatastore returns a read only datastore if available, otherwise a normal datastore