user

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Code generated by yo. DO NOT EDIT. Package user contains the types.

Code generated by yo. DO NOT EDIT. Package user contains the types.

Index

Constants

This section is empty.

Variables

View Source
var YOLog = func(context.Context, string, ...interface{}) {}

YOLog provides the log func used by generated queries.

Functions

func UserColumns

func UserColumns() []string

func UserPrimaryKeys

func UserPrimaryKeys() []string

func UserWritableColumns

func UserWritableColumns() []string

Types

type User

type User struct {
	ID        string    `spanner:"Id" json:"Id"`               // Id
	Name      string    `spanner:"Name" json:"Name"`           // Name
	Email     string    `spanner:"Email" json:"Email"`         // Email
	CreatedAt time.Time `spanner:"CreatedAt" json:"CreatedAt"` // CreatedAt
	UpdatedAt time.Time `spanner:"UpdatedAt" json:"UpdatedAt"` // UpdatedAt
}

User represents a row from 'Users'.

func FindUser

func FindUser(ctx context.Context, db YORODB, id string) (*User, error)

FindUser gets a User by primary key

func ReadUser

func ReadUser(ctx context.Context, db YORODB, keys spanner.KeySet) ([]*User, error)

ReadUser retrieves multiples rows from User by KeySet as a slice.

func (*User) Delete

func (u *User) Delete(ctx context.Context) *spanner.Mutation

Delete deletes the User from the database.

func (*User) Insert

func (u *User) Insert(ctx context.Context) *spanner.Mutation

Insert returns a Mutation to insert a row into a table. If the row already exists, the write or transaction fails.

func (*User) InsertOrUpdate

func (u *User) InsertOrUpdate(ctx context.Context) *spanner.Mutation

InsertOrUpdate returns a Mutation to insert a row into a table. If the row already exists, it updates it instead. Any column values not explicitly written are preserved.

func (*User) Update

func (u *User) Update(ctx context.Context) *spanner.Mutation

Update returns a Mutation to update a row in a table. If the row does not already exist, the write or transaction fails.

func (*User) UpdateColumns

func (u *User) UpdateColumns(ctx context.Context, cols ...string) (*spanner.Mutation, error)

UpdateColumns returns a Mutation to update specified columns of a row in a table.

type YODB

type YODB interface {
	YORODB
}

YODB is the common interface for database operations.

type YORODB

type YORODB interface {
	ReadRow(ctx context.Context, table string, key spanner.Key, columns []string) (*spanner.Row, error)
	Read(ctx context.Context, table string, keys spanner.KeySet, columns []string) *spanner.RowIterator
	ReadUsingIndex(ctx context.Context, table, index string, keys spanner.KeySet, columns []string) (ri *spanner.RowIterator)
	Query(ctx context.Context, statement spanner.Statement) *spanner.RowIterator
}

YORODB is the common interface for database operations.

Jump to

Keyboard shortcuts

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