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
|
||||
}
|
||||
|
||||
now := c.Now()
|
||||
variable.CreatedAt = now
|
||||
variable.UpdatedAt = now
|
||||
|
||||
if pe := c.putVariable(ctx, tx, variable); pe != nil {
|
||||
return &platform.Error{
|
||||
Op: op,
|
||||
|
|
|
@ -103,6 +103,9 @@ func (s *Service) CreateVariable(ctx context.Context, m *platform.Variable) erro
|
|||
Err: err,
|
||||
}
|
||||
}
|
||||
now := s.Now()
|
||||
m.CreatedAt = now
|
||||
m.UpdatedAt = now
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ const (
|
|||
|
||||
var oldFakeDate = time.Date(2002, 8, 5, 2, 2, 3, 0, time.UTC)
|
||||
var fakeDate = time.Date(2006, 5, 4, 1, 2, 3, 0, time.UTC)
|
||||
var fakeGenerator = mock.TimeGenerator{FakeValue: fakeDate}
|
||||
var fakeGenerator = mock.TimeGenerator{FakeValue:fakeDate}
|
||||
|
||||
var variableCmpOptions = cmp.Options{
|
||||
cmp.Comparer(func(x, y []byte) bool {
|
||||
|
@ -167,10 +167,6 @@ func CreateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
|||
Type: "constant",
|
||||
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",
|
||||
Values: platform.VariableConstantValues{},
|
||||
},
|
||||
CRUDLog: platform.CRUDLog{
|
||||
CreatedAt: fakeDate,
|
||||
UpdatedAt: fakeDate,
|
||||
},
|
||||
//CRUDLog: platform.CRUDLog{
|
||||
// CreatedAt: fakeDate,
|
||||
// UpdatedAt: fakeDate,
|
||||
//},
|
||||
},
|
||||
{
|
||||
ID: MustIDBase16(idB),
|
||||
|
@ -582,7 +578,7 @@ func UpdateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
|||
},
|
||||
CRUDLog: platform.CRUDLog{
|
||||
CreatedAt: oldFakeDate,
|
||||
UpdatedAt: oldFakeDate,
|
||||
UpdatedAt: fakeDate,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -595,7 +591,7 @@ func UpdateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
|||
},
|
||||
CRUDLog: platform.CRUDLog{
|
||||
CreatedAt: oldFakeDate,
|
||||
UpdatedAt: oldFakeDate,
|
||||
UpdatedAt: fakeDate,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -619,7 +615,7 @@ func UpdateVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
|||
},
|
||||
CRUDLog: platform.CRUDLog{
|
||||
CreatedAt: oldFakeDate,
|
||||
UpdatedAt: oldFakeDate,
|
||||
UpdatedAt: fakeDate,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -766,6 +762,10 @@ func DeleteVariable(init func(VariableFields, *testing.T) (platform.VariableServ
|
|||
Type: "constant",
|
||||
Values: platform.VariableConstantValues{},
|
||||
},
|
||||
CRUDLog: platform.CRUDLog{
|
||||
CreatedAt: oldFakeDate,
|
||||
UpdatedAt: oldFakeDate,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue