first drafts for inventory sync page
This commit is contained in:
@@ -16,12 +16,6 @@ type (
|
||||
db *pgxpool.Pool
|
||||
}
|
||||
|
||||
// StoreWithContext allows currying all Store methods by context.Context
|
||||
StoreWithContext struct {
|
||||
ctx context.Context
|
||||
db *Store
|
||||
}
|
||||
|
||||
Event struct {
|
||||
Platform string
|
||||
StoreID string
|
||||
@@ -38,10 +32,7 @@ func NewStore(db *pgxpool.Pool) *Store {
|
||||
}
|
||||
|
||||
func (db *Store) WithContext(ctx context.Context) *StoreWithContext {
|
||||
return &StoreWithContext{
|
||||
ctx: ctx,
|
||||
db: db,
|
||||
}
|
||||
return NewStoreWithContext(ctx, db)
|
||||
}
|
||||
|
||||
func (db *Store) Save(ctx context.Context, e *Event) error {
|
||||
@@ -81,10 +72,6 @@ func (db *Store) Save(ctx context.Context, e *Event) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (db *StoreWithContext) Save(e *Event) error {
|
||||
return db.db.Save(db.ctx, e)
|
||||
}
|
||||
|
||||
func (db *Store) LoadEventsForStore(
|
||||
ctx context.Context,
|
||||
platform string,
|
||||
@@ -125,10 +112,3 @@ func (db *Store) LoadEventsForStore(
|
||||
|
||||
return evts, nil
|
||||
}
|
||||
|
||||
func (db *StoreWithContext) LoadEventsForStore(
|
||||
platform string,
|
||||
storeID string,
|
||||
) ([]Event, error) {
|
||||
return db.db.LoadEventsForStore(db.ctx, platform, storeID)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Code generated by concurry DO NOT EDIT.
|
||||
// https://github.com/angelbeltran/concurry
|
||||
// concurry
|
||||
package raw_events
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
type StoreWithContext struct {
|
||||
ctx context.Context
|
||||
*Store
|
||||
}
|
||||
|
||||
func NewStoreWithContext(ctx context.Context, v *Store) *StoreWithContext {
|
||||
return &StoreWithContext{
|
||||
ctx: ctx,
|
||||
Store: v,
|
||||
}
|
||||
}
|
||||
|
||||
func (v_ctx *StoreWithContext) Save(e *Event) error {
|
||||
return v_ctx.Store.Save(v_ctx.ctx, e)
|
||||
}
|
||||
|
||||
func (v_ctx *StoreWithContext) LoadEventsForStore(platform string, storeID string) ([]Event, error) {
|
||||
return v_ctx.Store.LoadEventsForStore(v_ctx.ctx, platform, storeID)
|
||||
}
|
||||
Reference in New Issue
Block a user