models

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = NotFoundError{}
View Source
var ErrPrimaryKeyMissing = PrimaryKeyMissingError{}

Functions

This section is empty.

Types

type NotFoundError

type NotFoundError struct{}

func (NotFoundError) Error

func (e NotFoundError) Error() string

type Post

type Post struct {
	schema.Schema
	// db related fields
	ID        uuid.UUID
	UserID    uuid.UUID
	Title     string
	Body      string
	Status    string
	CreatedAt time.Time
	UpdatedAt time.Time

	// non-db related fields
	User User
}

func NewPost

func NewPost() *Post

func NewPostWith

func NewPostWith(obj Post) *Post

func (*Post) Assign

func (obj *Post) Assign(v Post)

func (Post) Columns

func (obj Post) Columns() []string

func (*Post) Destroy

func (obj *Post) Destroy(ctx context.Context, qr queryer) error

func (*Post) Find

func (obj *Post) Find(ctx context.Context, qr queryer) error

func (Post) JSONAPISerialize

func (obj Post) JSONAPISerialize() (string, error)

func (*Post) Save

func (obj *Post) Save(ctx context.Context, qr queryer) error

func (*Post) Scan

func (obj *Post) Scan(rows scanner) error

func (Post) ToJSONAPIResource

func (obj Post) ToJSONAPIResource() (jsonapi.Resource, jsonapi.Resources)

type PrimaryKeyMissingError

type PrimaryKeyMissingError struct{}

func (PrimaryKeyMissingError) Error

func (e PrimaryKeyMissingError) Error() string

type User

type User struct {
	schema.Schema
	// db related fields
	ID        uuid.UUID
	Username  string
	Bio       *string
	Email     string
	CreatedAt time.Time
	UpdatedAt time.Time

	// non-db related fields
	Posts []Post
}

func NewUser

func NewUser() *User

func NewUserWith

func NewUserWith(obj User) *User

func (*User) Assign

func (obj *User) Assign(v User)

func (User) Columns

func (obj User) Columns() []string

func (*User) Destroy

func (obj *User) Destroy(ctx context.Context, qr queryer) error

func (*User) Find

func (obj *User) Find(ctx context.Context, qr queryer) error

func (User) JSONAPISerialize

func (obj User) JSONAPISerialize() (string, error)

func (*User) Save

func (obj *User) Save(ctx context.Context, qr queryer) error

func (*User) Scan

func (obj *User) Scan(rows scanner) error

func (User) ToJSONAPIResource

func (obj User) ToJSONAPIResource() (jsonapi.Resource, jsonapi.Resources)

Jump to

Keyboard shortcuts

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