Store: use "at" suffix for time base fields more consistently (#58486)
This commit is contained in:
@@ -72,8 +72,8 @@ func (s *sqlObjectServer) rowToReadObjectResponse(ctx context.Context, rows *sql
|
||||
args := []interface{}{
|
||||
&path, &raw.GRN.Kind, &raw.Version,
|
||||
&raw.Size, &raw.ETag, &summaryjson.errors,
|
||||
&raw.Created, &raw.CreatedBy,
|
||||
&raw.Updated, &raw.UpdatedBy,
|
||||
&raw.CreatedAt, &raw.CreatedBy,
|
||||
&raw.UpdatedAt, &raw.UpdatedBy,
|
||||
&syncSrc, &syncTime,
|
||||
}
|
||||
if r.WithBody {
|
||||
@@ -193,12 +193,12 @@ func (s *sqlObjectServer) readFromHistory(ctx context.Context, r *object.ReadObj
|
||||
rsp := &object.ReadObjectResponse{
|
||||
Object: raw,
|
||||
}
|
||||
err = rows.Scan(&raw.Body, &raw.Size, &raw.ETag, &raw.Updated, &raw.UpdatedBy)
|
||||
err = rows.Scan(&raw.Body, &raw.Size, &raw.ETag, &raw.UpdatedAt, &raw.UpdatedBy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
// For versioned files, the created+updated are the same
|
||||
raw.Created = raw.Updated
|
||||
raw.CreatedAt = raw.UpdatedAt
|
||||
raw.CreatedBy = raw.UpdatedBy
|
||||
raw.Version = r.Version // from the query
|
||||
|
||||
@@ -357,7 +357,7 @@ func (s *sqlObjectServer) Write(ctx context.Context, r *object.WriteObjectReques
|
||||
// 1. Add the `object_history` values
|
||||
versionInfo.Size = int64(len(body))
|
||||
versionInfo.ETag = etag
|
||||
versionInfo.Updated = timestamp
|
||||
versionInfo.UpdatedAt = timestamp
|
||||
versionInfo.UpdatedBy = store.GetUserIDString(modifier)
|
||||
_, err = tx.Exec(ctx, `INSERT INTO object_history (`+
|
||||
"path, version, message, "+
|
||||
@@ -454,7 +454,7 @@ func (s *sqlObjectServer) selectForUpdate(ctx context.Context, tx *session.Sessi
|
||||
}
|
||||
current := &object.ObjectVersionInfo{}
|
||||
if rows.Next() {
|
||||
err = rows.Scan(¤t.ETag, ¤t.Version, ¤t.Updated, ¤t.Size)
|
||||
err = rows.Scan(¤t.ETag, ¤t.Version, ¤t.UpdatedAt, ¤t.Size)
|
||||
}
|
||||
if err == nil {
|
||||
err = rows.Close()
|
||||
@@ -541,7 +541,7 @@ func (s *sqlObjectServer) History(ctx context.Context, r *object.ObjectHistoryRe
|
||||
}
|
||||
for rows.Next() {
|
||||
v := &object.ObjectVersionInfo{}
|
||||
err := rows.Scan(&v.Version, &v.Size, &v.ETag, &v.Updated, &v.UpdatedBy, &v.Comment)
|
||||
err := rows.Scan(&v.Version, &v.Size, &v.ETag, &v.UpdatedAt, &v.UpdatedBy, &v.Comment)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -558,7 +558,7 @@ func (s *sqlObjectServer) Search(ctx context.Context, r *object.ObjectSearchRequ
|
||||
|
||||
fields := []string{
|
||||
"path", "kind", "version", "errors", // errors are always returned
|
||||
"updated_at", "updated_by",
|
||||
"size", "updated_at", "updated_by",
|
||||
"name", "description", // basic summary
|
||||
}
|
||||
|
||||
@@ -623,7 +623,7 @@ func (s *sqlObjectServer) Search(ctx context.Context, r *object.ObjectSearchRequ
|
||||
|
||||
args := []interface{}{
|
||||
&key, &result.GRN.Kind, &result.Version, &summaryjson.errors,
|
||||
&result.Updated, &result.UpdatedBy,
|
||||
&result.Size, &result.UpdatedAt, &result.UpdatedBy,
|
||||
&result.Name, &summaryjson.description,
|
||||
}
|
||||
if r.WithBody {
|
||||
|
||||
Reference in New Issue
Block a user