appier/sync.go

101 lines
2.1 KiB
Go
Raw Permalink Normal View History

2022-03-24 10:04:34 +00:00
package appier
import (
"context"
"github.com/Selly-Modules/redisdb"
)
// Sync ...
type Sync struct{}
// SyncProduct ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncProduct(productID string, product interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncProduct, productID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, product)
2022-03-24 10:04:34 +00:00
return
}
// SyncBrand ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncBrand(brandID string, brand interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncBrand, brandID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, brand)
2022-03-24 10:04:34 +00:00
return
}
// SyncSupplier ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncSupplier(supplierID string, supplier interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncSupplier, supplierID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, supplier)
2022-03-24 10:04:34 +00:00
return
}
// SyncInventory ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncInventory(inventoryID string, inventory interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncInventory, inventoryID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, inventory)
2022-03-24 10:04:34 +00:00
return
}
// SyncCategory ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncCategory(categoryID string, category interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncCategory, categoryID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, category)
2022-03-24 10:04:34 +00:00
return
}
// SyncSubCategory ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncSubCategory(subcategoryID string, value interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncSubCategory, subcategoryID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, value)
2022-03-24 10:04:34 +00:00
return
}
// SyncProperty ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncProperty(propertyID string, value interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncProperty, propertyID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, value)
2022-03-24 10:04:34 +00:00
return
}
// SyncPropertyValue ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncPropertyValue(propertyValueID string, value interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncPropertyValue, propertyValueID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, value)
2022-03-24 10:04:34 +00:00
return
}
// SyncSKU ...
2022-03-25 08:54:40 +00:00
func (Sync) SyncSKU(skuID string, value interface{}) {
2022-03-24 10:04:34 +00:00
ctx := context.Background()
key := getRedisKey(RedisSyncSKU, skuID)
// Set redis
2022-03-25 08:54:40 +00:00
redisdb.SetKeyValue(ctx, key, value)
2022-03-24 10:04:34 +00:00
return
}