Skip to content

Commit

Permalink
add metadata to document (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lambdaaa authored Apr 24, 2024
1 parent 49f1c12 commit 4bb2de9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ import (

// Document holds document content and some meta data.
type Document struct {
Content []byte `json:"content,omitempty"`
ModifiedDate time.Time `json:"modifiedDate,omitempty"`
ContentType string `json:"contentType,omitempty"`
Name string `json:"name,omitempty"`
Content []byte `json:"content,omitempty"`
ModifiedDate time.Time `json:"modifiedDate,omitempty"`
ContentType string `json:"contentType,omitempty"`
Name string `json:"name,omitempty"`
MetaData map[string]string `json:"metadata,omitempty"`
}

// ErrNotFound indicates that the requested document does not exist.
Expand Down Expand Up @@ -317,6 +318,7 @@ func (s *s3) DownloadFile(ctx context.Context, path string) (*Document, error) {
ModifiedDate: fileInfo.LastModified,
ContentType: fileInfo.ContentType,
Name: docName,
MetaData: fileInfo.UserMetadata,
}

return document, nil
Expand Down

0 comments on commit 4bb2de9

Please sign in to comment.