Skip to content

Instantly share code, notes, and snippets.

Created July 16, 2022 02:12
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hernanhrm/8375b8dfe4de870aec533e57cf1440b5 to your computer and use it in GitHub Desktop.
// GetEmployees returns a list of employees with a pre-signed URL to their profile picture
// to make the example easier to follow, I have a mock data with a list of employees,
// so we don't need to use a database
func (u FileManager) GetEmployees() ([]Employee, error) {
for i, _ := range employees {
preSignedURL, err := u.service.Presign(employees[i].Picture)
if err != nil {
return nil, fmt.Errorf("filemanager.GetEmployees(): %w", err)
employees[i].PreSignedPicture = preSignedURL
return employees, nil
// mock data for the example, this should be in a database
var employees = Employees{
Name: "Hernan Reyes",
Picture: "employees/149d6d2d-6adb-464a-ad97-1927cffce309.jpg",
Name: "Juan Perez",
Picture: "employees/88c5d68b-4cac-466e-bb81-c0c4deb49534.jpg",
Name: "Pedro Perez",
Picture: "employees/1399d998-b505-4ce2-b49b-bd8073de9b9e.jpg",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment