// Package models contains the types for schema 'public'.
package models

// Code generated by xo. DO NOT EDIT.

// Settings
type Setting struct {
	Name    string // name
	Setting string // setting
}

// GetSettings runs a custom query, returning results as Setting.
func GetSettings(db XODB) ([]*Setting, error) {
	var err error

	// sql query
	const sqlstr = `SELECT name, setting ` +
		`FROM pg_settings`

	// run query
	XOLog(sqlstr)
	q, err := db.Query(sqlstr)
	if err != nil {
		return nil, err
	}
	defer q.Close()

	// load results
	res := []*Setting{}
	for q.Next() {
		s := Setting{}

		// scan
		err = q.Scan(&s.Name, &s.Setting)
		if err != nil {
			return nil, err
		}

		res = append(res, &s)
	}

	return res, nil
}
