database

package
v0.0.0-...-673c5a3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2022 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultDSN = "host=localhost user=dictator password=dictator dbname=dictator sslmode=disable"

Functions

func Migrate

func Migrate(db *DB) error

Types

type DB

type DB = gorm.DB

func Open

func Open(dsn string) (*DB, error)

type Like

type Like struct {
	UserID int `gorm:"primaryKey;not null"`
	User   *User
	RuleID int `gorm:"primaryKey;not null"`
	Rule   *Rule
}

type Rule

type Rule struct {
	ID      int `gorm:"primaryKey;not null"`
	UserID  int `gorm:"not null"` // TODO: Rename to UserID
	User    *User
	Created time.Time `gorm:"not null"`
	Summary string    `gorm:"not null"`
	Detail  *string
	Likes   []User `gorm:"many2many:likes"`
}

func (Rule) IDAfter

func (r Rule) IDAfter() func(*gorm.DB) *gorm.DB

func (Rule) IDBeforeOrEqual

func (r Rule) IDBeforeOrEqual() func(*gorm.DB) *gorm.DB

func (Rule) IDRef

func (r Rule) IDRef() *int

type RuleLike

type RuleLike Like

func (RuleLike) IDAfter

func (l RuleLike) IDAfter() func(*gorm.DB) *gorm.DB

func (RuleLike) IDBeforeOrEqual

func (l RuleLike) IDBeforeOrEqual() func(*gorm.DB) *gorm.DB

func (RuleLike) IDRef

func (l RuleLike) IDRef() *int

func (RuleLike) TableName

func (l RuleLike) TableName() string

type User

type User struct {
	ID    int    `gorm:"primaryKey;not null"`
	Name  string `gorm:"unique;not null"`
	Email string `gorm:"unique;not null"`
	Salt  []byte `gorm:"not null"`
	Key   []byte `gorm:"not null"`
	Likes []Rule `gorm:"many2many:likes"`
}

func (User) IDAfter

func (u User) IDAfter() func(*gorm.DB) *gorm.DB

func (User) IDBeforeOrEqual

func (u User) IDBeforeOrEqual() func(*gorm.DB) *gorm.DB

func (User) IDRef

func (u User) IDRef() *int

func (User) Item

func (u User) Item() *User

func (User) NameLike

func (u User) NameLike() func(db *gorm.DB) *gorm.DB

type UserLike

type UserLike Like

func (UserLike) IDAfter

func (l UserLike) IDAfter() func(*gorm.DB) *gorm.DB

func (UserLike) IDBeforeOrEqual

func (l UserLike) IDBeforeOrEqual() func(*gorm.DB) *gorm.DB

func (UserLike) IDRef

func (l UserLike) IDRef() *int

func (UserLike) TableName

func (l UserLike) TableName() string

Jump to

Keyboard shortcuts

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