example

package
v0.0.0-...-1e29435 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2020 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Code generated by norm. DO NOT EDIT. Generated on: 2020-12-26 18:50:49.673523925 -0800 PST m=+0.002477716

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddUser

func AddUser(db *sql.DB, email string) error

Add a user to the DB

func CreateUserTable

func CreateUserTable(db *sql.DB) error

Creates the user table

func DeleteAllUsers

func DeleteAllUsers(db *sql.DB) error

Deletes all users from the DB

func FindUserEmail

func FindUserEmail(db *sql.DB, email string) (*string, error)

Finds user by email.

func GetUserEmailsNoModel

func GetUserEmailsNoModel(db *sql.DB) ([]string, error)

Types

type FindUserOutput

type FindUserOutput struct {
	ID    int
	Email string
}

func FindUser

func FindUser(db *sql.DB, email string) (*FindUserOutput, error)

Finds user by email

type GetUserEmailsNoModelResult

type GetUserEmailsNoModelResult struct {
	// contains filtered or unexported fields
}

func GetUserEmailsNoModelScan

func GetUserEmailsNoModelScan(db *sql.DB) (*GetUserEmailsNoModelResult, error)

Retrieves all emails from the users table. In this example, there is// only one output field. Therefore an intermediate struct is also not needed,// we just return a slice of the output type (string in this case)

func (GetUserEmailsNoModelResult) Close

func (res GetUserEmailsNoModelResult) Close()

func (GetUserEmailsNoModelResult) Next

func (res GetUserEmailsNoModelResult) Next() bool

func (GetUserEmailsNoModelResult) Scan

func (res GetUserEmailsNoModelResult) Scan(Email *string) error

type GetUserListNoModelOutput

type GetUserListNoModelOutput struct {
	ID    int
	Email string
}

func GetUserListNoModel

func GetUserListNoModel(db *sql.DB) ([]GetUserListNoModelOutput, error)

type GetUserListNoModelResult

type GetUserListNoModelResult struct {
	// contains filtered or unexported fields
}

func GetUserListNoModelScan

func GetUserListNoModelScan(db *sql.DB) (*GetUserListNoModelResult, error)

Retrieves all emails from the users table. Since there is no// intermediate model, an output struct is autocreated which will contain only// the fields specified in the output. Please make sure that the field names// are capitalized.

func (GetUserListNoModelResult) Close

func (res GetUserListNoModelResult) Close()

func (GetUserListNoModelResult) Next

func (res GetUserListNoModelResult) Next() bool

func (GetUserListNoModelResult) Scan

func (res GetUserListNoModelResult) Scan(ID *int, Email *string) error

type GetUserListWithModelResult

type GetUserListWithModelResult struct {
	// contains filtered or unexported fields
}

func GetUserListWithModelScan

func GetUserListWithModelScan(db *sql.DB) (*GetUserListWithModelResult, error)

Retrieves all emails from the users table. In this example, an// intermediate model is used. See `gen.go` for the model definition. This// allows users to specify an arbitrary intermediate struct.

func (GetUserListWithModelResult) Close

func (res GetUserListWithModelResult) Close()

func (GetUserListWithModelResult) Next

func (res GetUserListWithModelResult) Next() bool

func (GetUserListWithModelResult) Scan

func (res GetUserListWithModelResult) Scan(ID *int, Email *string) error

type User

type User struct {
	ID    int
	Email string
}

func GetUserListWithModel

func GetUserListWithModel(db *sql.DB) ([]User, error)

Jump to

Keyboard shortcuts

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