Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Commit

Permalink
add uuid
Browse files Browse the repository at this point in the history
  • Loading branch information
hawl1 committed May 14, 2024
1 parent 15696b6 commit bc31331
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions func.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/nfnt/resize"

// "github.com/gofrs/uuid"
"github.com/gofrs/uuid"
fdk "github.com/fnproject/fdk-go"
fauxgl "github.com/hawl1/brickgl"
)
Expand Down Expand Up @@ -48,7 +48,7 @@ type Avatar struct {

// ImageResponse lambda response for a base64 encoded render
type ImageResponse struct {
// gonna fix this, can stay for now UUID string `json:"uuid"`
UUID string `json:"uuid"`
Image string `json:"image"`
}

Expand Down Expand Up @@ -333,8 +333,12 @@ func HandleRenderEvent(ctx context.Context, in io.Reader, out io.Writer) {
fmt.Fprintln(out, "Error:", err)
}

namespaceUUID := uuid.Must(uuid.FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8"))
uuid := uuid.NewV5(namespaceUUID, "lunar-hill")

resp := ImageResponse{
Image: base64.StdEncoding.EncodeToString(buf.Bytes()),
UUID: uuid.String(),
}

json.NewEncoder(out).Encode(resp)
Expand Down
2 changes: 1 addition & 1 deletion func.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
schema_version: 20180708
name: render
version: 0.2.0
version: 0.2.1
runtime: go
build_image: fnproject/go:1.19-dev
run_image: fnproject/go:1.19
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require (
require (
github.com/disintegration/imaging v1.6.2 // indirect
github.com/fogleman/simplify v0.0.0-20170216171241-d32f302d5046 // indirect
github.com/gofrs/uuid v4.4.0+incompatible
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ github.com/fnproject/fdk-go v0.0.39 h1:ro/APuyc2Vj/Yq4s4fXn2Ici74HcKfEYJkdY4hkDD
github.com/fnproject/fdk-go v0.0.39/go.mod h1:hCpiyW8oIJpRdegoLf8PxKf9k+8mZZGeYgwSKOVG+K0=
github.com/fogleman/simplify v0.0.0-20170216171241-d32f302d5046 h1:n3RPbpwXSFT0G8FYslzMUBDO09Ix8/dlqzvUkcJm4Jk=
github.com/fogleman/simplify v0.0.0-20170216171241-d32f302d5046/go.mod h1:KDwyDqFmVUxUmo7tmqXtyaaJMdGon06y8BD2jmh84CQ=
github.com/gofrs/uuid v4.4.0+incompatible h1:3qXRTX8/NbyulANqlc0lchS1gqAVxRgsuW1YrTJupqA=
github.com/gofrs/uuid v4.4.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=
github.com/hawl1/brickgl v0.0.0-20240126142839-ad612bf48d3f h1:Bw3tBGtcZvKTtUjP9wKPhf3+WP80lAnN3+I3DmtXSoA=
github.com/hawl1/brickgl v0.0.0-20240126142839-ad612bf48d3f/go.mod h1:7AcuuDLjY7w9/m3+ZolkfhdtXefRRx/Yp4IRWJJBzwE=
github.com/hawl1/brickgl v0.0.0-20240130205028-d030712ee87c h1:uVQMifz2l34UDrukzmolwTHehBisw2kMyeOFuml0II4=
Expand Down

0 comments on commit bc31331

Please sign in to comment.