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

// Code generated by xo. DO NOT EDIT.

// PortAndDatadir represents a row from '[custom port_and_datadir]'.
type PortAndDatadir struct {
	Name    string // name
	Setting string // setting
}

// GetPortAndDatadir runs a custom query, returning results as PortAndDatadir.
func GetPortAndDatadir(db XODB) (*PortAndDatadir, error) {
	var err error

	// sql query
	var sqlstr = `SELECT name, ` +
		`setting ` +
		`FROM pg_settings ` +
		`WHERE name IN ('port','data_directory')`

	// run query
	XOLog(sqlstr)
	var pad PortAndDatadir
	err = db.QueryRow(sqlstr).Scan(&pad.Name, &pad.Setting)
	if err != nil {
		return nil, err
	}

	return &pad, nil
}
