sql

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config = &gorm.Config{
	TranslateError: true,
}

Functions

func Close

func Close(database *Database) error

func UserTable

func UserTable(database *Database) (repository.User, error)

Types

type Database

type Database struct {
	Session *gorm.DB
}

func OpenMySQL

func OpenMySQL(dsn, name string) (*Database, error)

func OpenSQLite

func OpenSQLite(filename string) (*Database, error)

type User

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

func (*User) Delete

func (database *User) Delete(name *user.Name) error

func (*User) Save

func (database *User) Save(user *user.User) error

func (*User) Search

func (database *User) Search(name *user.Name) (*user.User, error)

func (*User) Update

func (database *User) Update(user *user.User) error

type UserModel

type UserModel struct {
	gorm.Model
	Name string `gorm:"index:idx_name,unique"`
	Role string
}

Jump to

Keyboard shortcuts

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