This commit is contained in:
Minh Nguyen 2022-03-25 15:54:40 +07:00
parent e9814e070b
commit 2fa70e4310
1 changed files with 18 additions and 18 deletions

36
sync.go
View File

@ -10,91 +10,91 @@ import (
type Sync struct{} type Sync struct{}
// SyncProduct ... // SyncProduct ...
func (Sync) SyncProduct(productID string, productJSONString string) { func (Sync) SyncProduct(productID string, product interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncProduct, productID) key := getRedisKey(RedisSyncProduct, productID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, productJSONString) redisdb.SetKeyValue(ctx, key, product)
return return
} }
// SyncBrand ... // SyncBrand ...
func (Sync) SyncBrand(brandID, brandJSONString string) { func (Sync) SyncBrand(brandID string, brand interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncBrand, brandID) key := getRedisKey(RedisSyncBrand, brandID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, brandJSONString) redisdb.SetKeyValue(ctx, key, brand)
return return
} }
// SyncSupplier ... // SyncSupplier ...
func (Sync) SyncSupplier(supplierID, supplierJSONString string) { func (Sync) SyncSupplier(supplierID string, supplier interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncSupplier, supplierID) key := getRedisKey(RedisSyncSupplier, supplierID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, supplierJSONString) redisdb.SetKeyValue(ctx, key, supplier)
return return
} }
// SyncInventory ... // SyncInventory ...
func (Sync) SyncInventory(inventoryID, inventoryJSONString string) { func (Sync) SyncInventory(inventoryID string, inventory interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncInventory, inventoryID) key := getRedisKey(RedisSyncInventory, inventoryID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, inventoryJSONString) redisdb.SetKeyValue(ctx, key, inventory)
return return
} }
// SyncCategory ... // SyncCategory ...
func (Sync) SyncCategory(categoryID, categoryJSONString string) { func (Sync) SyncCategory(categoryID string, category interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncCategory, categoryID) key := getRedisKey(RedisSyncCategory, categoryID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, categoryJSONString) redisdb.SetKeyValue(ctx, key, category)
return return
} }
// SyncSubCategory ... // SyncSubCategory ...
func (Sync) SyncSubCategory(subcategoryID, subCategoryJSONString string) { func (Sync) SyncSubCategory(subcategoryID string, value interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncSubCategory, subcategoryID) key := getRedisKey(RedisSyncSubCategory, subcategoryID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, subCategoryJSONString) redisdb.SetKeyValue(ctx, key, value)
return return
} }
// SyncProperty ... // SyncProperty ...
func (Sync) SyncProperty(propertyID, propertyJSONString string) { func (Sync) SyncProperty(propertyID string, value interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncProperty, propertyID) key := getRedisKey(RedisSyncProperty, propertyID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, propertyJSONString) redisdb.SetKeyValue(ctx, key, value)
return return
} }
// SyncPropertyValue ... // SyncPropertyValue ...
func (Sync) SyncPropertyValue(propertyValueID, propertyValueJSONString string) { func (Sync) SyncPropertyValue(propertyValueID string, value interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncPropertyValue, propertyValueID) key := getRedisKey(RedisSyncPropertyValue, propertyValueID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, propertyValueJSONString) redisdb.SetKeyValue(ctx, key, value)
return return
} }
// SyncSKU ... // SyncSKU ...
func (Sync) SyncSKU(skuID, skuJSONString string) { func (Sync) SyncSKU(skuID string, value interface{}) {
ctx := context.Background() ctx := context.Background()
key := getRedisKey(RedisSyncSKU, skuID) key := getRedisKey(RedisSyncSKU, skuID)
// Set redis // Set redis
redisdb.SetKeyValue(ctx, key, skuJSONString) redisdb.SetKeyValue(ctx, key, value)
return return
} }