Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import "fmt"
type User struct {
ID string
Email string
Username string
}
type DynamoTable struct {
Name string
GSI string
}
func saveItem(table DynamoTable, user User) {
fmt.Println("Table:", table.Name)
fmt.Println("Stored User:", user.ID, user.Username)
fmt.Println("Using GSI:", table.GSI)
}
func main() {
table := DynamoTable{
Name: "UsersTable",
GSI: "EmailIndex",
}
user := User{
ID: "user-101",
Email: "user@example.com",
Username: "alice",
}
saveItem(table, user)
}Coding works best on desktop or with an external keyboard.