Skip to content

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
syntaqx committed Jun 28, 2024
1 parent 329c3ab commit e1850fc
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# cookie

Cookies, but with structs

```go
type User struct {
ID uuid.UUID `cookie:"user_id"`
Name string `cookie:"user_name"`
}

...

var user User
err := cookie.PopulateFromCookies(r, &user)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}

fmt.Println(user.ID, user.Name)
```

0 comments on commit e1850fc

Please sign in to comment.