tables

package
v0.0.0-...-f829f03 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UUIDWithPrefix

func UUIDWithPrefix(prefix string) string

UUIDWithPrefix generates a UUID with a prefix

Types

type DB

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

A struct on which the methods are defined

func NewDB

func NewDB(gormDB *gorm.DB) *DB

func (*DB) CreateUser

func (db *DB) CreateUser(user *Users) error

Create a new user

func (*DB) GetUserByID

func (db *DB) GetUserByID(id int) (*Users, error)

Get a user by id

func (*DB) GetUserByPID

func (db *DB) GetUserByPID(pid string) (*Users, error)

Get a user by pid

type Users

type Users struct {
	ID  int    `gorm:"column:id;primaryKey;autoIncrement"`
	PID string `gorm:"column:pid;unique;not null;type:varchar(40)"`
	// Name               string `gorm:"column:name;not null;type:varchar(100)"`
	Email string `gorm:"column:email;unique;type:varchar(100)"`
	// Phone              string `gorm:"column:phone;not null;type:varchar(10)"`
	// RegistrationNumber string `gorm:"column:registration_number;type:varchar(9)"` // optional
	Password []byte `gorm:"column:password;not null"`
	// IsExternal         bool   `gorm:"column:is_external;not null;default:false"`
	IsVerified bool `gorm:"column:is_verified;not null;default:false"`
	// IsSandbox          bool   `gorm:"column:is_sandbox;not null;default:false"`
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (*Users) TableName

func (t *Users) TableName() string

Jump to

Keyboard shortcuts

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