Created
March 12, 2017 11:16
dynamo query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
as := dynamo.New(sess, &aws.Config{Region: aws.String("ap-southeast-1")}) | |
t := as.Table("Dev_Beam") | |
type SpMeta struct { | |
Distance float64 `dynamo:"distance"` | |
} | |
type beam struct { | |
TaskID int `dynamo:"task_id"` // Hash key, a.k.a. partition key | |
SpIDTimestamp string `dynamo:"sp_timestamp"` // Range key, a.k.a. sort key | |
SpMeta SpMeta `dynamo:"sp_meta"` | |
} | |
var beams []beam | |
if err = t.Scan().Filter("$.distance < ?", "sp_meta", 10).All(&beams); err != nil { | |
log.Fatal(err) | |
} | |
fmt.Print(beams) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment