models

package
v0.0.0-...-a61e21f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package models contains the types for schema ”.

Package models contains the types for schema ”.

Index

Constants

This section is empty.

Variables

View Source
var XOLog = func(string, ...interface{}) {}

XOLog provides the log func used by generated queries.

Functions

This section is empty.

Types

type ScannerValuer

type ScannerValuer interface {
	sql.Scanner
	driver.Valuer
}

ScannerValuer is the common interface for types that implement both the database/sql.Scanner and sql/driver.Valuer interfaces.

type Slice

type Slice []ScannerValuer

Slice is a slice of ScannerValuers.

type StringSlice

type StringSlice []string

StringSlice is a slice of strings.

func (*StringSlice) Scan

func (ss *StringSlice) Scan(src interface{}) error

Scan satisfies the sql.Scanner interface for StringSlice.

func (StringSlice) Value

func (ss StringSlice) Value() (driver.Value, error)

Value satisfies the driver.Valuer interface for StringSlice.

type User

type User struct {
	ID       sql.NullInt64  `json:"id"`        // id
	Username sql.NullString `json:"username"`  // username
	Address  sql.NullString `json:"address"`   // address
	FullName sql.NullString `json:"full_name"` // full_name
	// contains filtered or unexported fields
}

User represents a row from 'users'.

func UserByID

func UserByID(db XODB, id sql.NullInt64) (*User, error)

UserByID retrieves a row from 'users' as a User.

Generated from index 'users_id_pkey'.

func UserByUsername

func UserByUsername(db XODB, username sql.NullString) (*User, error)

UserByUsername retrieves a row from 'users' as a User.

Generated from index 'sqlite_autoindex_users_1'.

func UsersByFullName

func UsersByFullName(db XODB, fullName sql.NullString) ([]*User, error)

UsersByFullName retrieves a row from 'users' as a User.

Generated from index 'name_index'.

func (*User) Delete

func (u *User) Delete(db XODB) error

Delete deletes the User from the database.

func (*User) Deleted

func (u *User) Deleted() bool

Deleted provides information if the User has been deleted from the database.

func (*User) Exists

func (u *User) Exists() bool

Exists determines if the User exists in the database.

func (*User) Insert

func (u *User) Insert(db XODB) error

Insert inserts the User to the database.

func (*User) Save

func (u *User) Save(db XODB) error

Save saves the User to the database.

func (*User) Update

func (u *User) Update(db XODB) error

Update updates the User in the database.

type XODB

type XODB interface {
	Exec(string, ...interface{}) (sql.Result, error)
	Query(string, ...interface{}) (*sql.Rows, error)
	QueryRow(string, ...interface{}) *sql.Row
}

XODB is the common interface for database operations that can be used with types from schema ”.

This should work with database/sql.DB and database/sql.Tx.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL