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

// Code generated by xo. DO NOT EDIT.

// ServerVersion represents a row from '[custom server_version]'.
type ServerVersion struct {
	Version string // version
}

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

	// sql query
	const sqlstr = `SELECT current_setting('server_version_num') AS version`

	// run query
	XOLog(sqlstr)
	var sv ServerVersion
	err = db.QueryRow(sqlstr).Scan(&sv.Version)
	if err != nil {
		return nil, err
	}

	return &sv, nil
}
