orm

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 19, 2021 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalID

func MarshalID(id hide.ID) graphql.Marshaler

MarshalID implements marshalling for IDs

func UnmarshalID

func UnmarshalID(v interface{}) (hide.ID, error)

UnmarshalID implements reverse marshalling for IDs from strings

Types

type Model

type Model struct {
	ID        hide.ID `gorm:"type: bigserial;primary_key" json:"id"` // int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

Model Default model structure with hard deleting

func (Model) IDint

func (m Model) IDint() int64

IDint returns the ID as an int64

func (Model) IDstring

func (m Model) IDstring() string

IDstring returns the ID as a hash string

type SoftDelete

type SoftDelete struct {
	ID        hide.ID `gorm:"type: bigserial;primary_key" json:"id"` // int64
	CreatedAt time.Time
	UpdatedAt time.Time
	DeletedAt *time.Time
}

SoftDelete Default model structure with soft deleting

func (SoftDelete) IDint

func (m SoftDelete) IDint() int64

IDint returns the ID as an int64

func (SoftDelete) IDstring

func (m SoftDelete) IDstring() string

IDstring returns the ID as a hash string

Jump to

Keyboard shortcuts

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