package models // Code generated by xo. DO NOT EDIT. import ( "context" ) // Points represents a row from 'points'. type Points struct { Points int `json:"points"` // points } // UserPoints runs a custom query, returning results as Points. func UserPoints(ctx context.Context, db DB, user_id string) (*Points, error) { // query const sqlstr = `SELECT COALESCE(SUM(points_awarded), 0) FROM question_attempt ` + `WHERE user_id=$1` // run logf(sqlstr, user_id) var p Points if err := db.QueryRowContext(ctx, sqlstr, user_id).Scan(&p.Points); err != nil { return nil, logerror(err) } return &p, nil }