models

package
v0.0.0-...-c4fc964 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID        int64     `gorm:"primaryKey" json:"id,omitempty"`
	CreatedAt time.Time `json:"created_at,omitempty"`
	UpdatedAt time.Time `json:"updated_at,omitempty"`

	// DeletedAt shouldn't be used for json encoding, since sql.NullTime doesn't implement json literals
	// and it should exist the moment users access the resource.
	DetetedAt sql.NullTime `gorm:"index" json:"-"`
}

type Group

type Group struct {
	Base
	ID          int64  `json:"id,omitempty"`
	Name        string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type GroupJoinCode

type GroupJoinCode struct {
	Base
	ID int64

	Group   Group
	GroupID int64

	Code string
}

link to join groups

type GroupUser

type GroupUser struct {
	Base

	Group   Group
	GroupID int64 `gorm:"not null"`

	User   User
	UserID int64 `gorm:"not null"`
}

users of a group

type Session

type Session struct {
	Base
	Username string
	Expiry   time.Time
	Token    uuid.UUID
}

type Todo

type Todo struct {
	Base
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Finished    bool   `gorm:"default:false" json:"finished,omitempty"`
}

type User

type User struct {
	Base
	ID           int64  `json:"id,omitempty"`
	Name         string `json:"name,omitempty"`
	Email        string `json:"email,omitempty"`
	Username     string `json:"username,omitempty"`
	PasswordHash []byte `json:"password_hash,omitempty"`

	HaveGroup bool  `gorm:"default:false" json:"have_group,omitempty"`
	GroupID   int64 `json:"group_id,omitempty"`
}

Jump to

Keyboard shortcuts

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