setting createdAt and updatedAt in bolt and inmem
parent
fa132d19a7
commit
4057183dac
|
@ -222,6 +222,10 @@ func (c *Client) CreateVariable(ctx context.Context, variable *platform.Variable
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
now := c.Now()
|
||||||
|
variable.CreatedAt = now
|
||||||
|
variable.UpdatedAt = now
|
||||||
|
|
||||||
if pe := c.putVariable(ctx, tx, variable); pe != nil {
|
if pe := c.putVariable(ctx, tx, variable); pe != nil {
|
||||||
return &platform.Error{
|
return &platform.Error{
|
||||||
Op: op,
|
Op: op,
|
||||||
|
|
|
@ -103,6 +103,9 @@ func (s *Service) CreateVariable(ctx context.Context, m *platform.Variable) erro
|
||||||
Err: err,
|
Err: err,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
now := s.Now()
|
||||||
|
m.CreatedAt = now
|
||||||
|
m.UpdatedAt = now
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,10 +167,6 @@ func CreateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
||||||
Type: "constant",
|
Type: "constant",
|
||||||
Values: platform.VariableConstantValues{"b"},
|
Values: platform.VariableConstantValues{"b"},
|
||||||
},
|
},
|
||||||
CRUDLog: platform.CRUDLog{
|
|
||||||
CreatedAt: fakeDate,
|
|
||||||
UpdatedAt: fakeDate,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -270,10 +266,10 @@ func FindVariableByID(init func(VariableFields, *testing.T) (platform.VariableSe
|
||||||
Type: "constant",
|
Type: "constant",
|
||||||
Values: platform.VariableConstantValues{},
|
Values: platform.VariableConstantValues{},
|
||||||
},
|
},
|
||||||
CRUDLog: platform.CRUDLog{
|
//CRUDLog: platform.CRUDLog{
|
||||||
CreatedAt: fakeDate,
|
// CreatedAt: fakeDate,
|
||||||
UpdatedAt: fakeDate,
|
// UpdatedAt: fakeDate,
|
||||||
},
|
//},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
ID: MustIDBase16(idB),
|
ID: MustIDBase16(idB),
|
||||||
|
@ -582,7 +578,7 @@ func UpdateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
||||||
},
|
},
|
||||||
CRUDLog: platform.CRUDLog{
|
CRUDLog: platform.CRUDLog{
|
||||||
CreatedAt: oldFakeDate,
|
CreatedAt: oldFakeDate,
|
||||||
UpdatedAt: oldFakeDate,
|
UpdatedAt: fakeDate,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -595,7 +591,7 @@ func UpdateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
||||||
},
|
},
|
||||||
CRUDLog: platform.CRUDLog{
|
CRUDLog: platform.CRUDLog{
|
||||||
CreatedAt: oldFakeDate,
|
CreatedAt: oldFakeDate,
|
||||||
UpdatedAt: oldFakeDate,
|
UpdatedAt: fakeDate,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -619,7 +615,7 @@ func UpdateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
||||||
},
|
},
|
||||||
CRUDLog: platform.CRUDLog{
|
CRUDLog: platform.CRUDLog{
|
||||||
CreatedAt: oldFakeDate,
|
CreatedAt: oldFakeDate,
|
||||||
UpdatedAt: oldFakeDate,
|
UpdatedAt: fakeDate,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -766,6 +762,10 @@ func DeleteVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
||||||
Type: "constant",
|
Type: "constant",
|
||||||
Values: platform.VariableConstantValues{},
|
Values: platform.VariableConstantValues{},
|
||||||
},
|
},
|
||||||
|
CRUDLog: platform.CRUDLog{
|
||||||
|
CreatedAt: oldFakeDate,
|
||||||
|
UpdatedAt: oldFakeDate,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue