persist

package
v0.0.0-...-5cc0681 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckUser

func CheckUser(dataFile, username, password string) (bool, bool, error)

func ImportRecord

func ImportRecord(dataFile string, records []*AccountRecord) error

func ModifyRecord

func ModifyRecord(dbFile, masterUserName, masterPassword string, newData *DecodedRecord) error

func ModifyUser

func ModifyUser(dataFile, username, password string) error

func RemoveRecord

func RemoveRecord(dbFile, masterUserName, recordName string) error

Types

type AccountRecord

type AccountRecord struct {
	ID              int64     `gorm:"PRIMARY_KEY;AUTO_INCREMENT"`
	UserName        string    `gorm:"size:255;index;not null"`
	Name            string    `gorm:"size:255;index;not null;unique"`
	Description     string    `gorm:"size:255"`
	LoginName       string    `gorm:"size:255;index"`
	Salt            string    `gorm:"size:255;not null;"`
	LoginPasswordEn string    `gorm:"size:255;index"`
	ExtraMessage    string    `gorm:"size:255;index"`
	IsRemoved       bool      `gorm:"index"`
	CreateTime      time.Time `gorm:"type:datetime"`
	UpdateTime      time.Time `gorm:"type:datetime"`
	RemoveTime      time.Time `gorm:"type:datetime"`
}

func DumpRecord

func DumpRecord(dataFile string, masterUserName string) ([]*AccountRecord, error)

func (AccountRecord) TableName

func (AccountRecord) TableName() string

type DecodedRecord

type DecodedRecord struct {
	Name          string
	Description   string
	LoginName     string
	LoginPassword string
	ExtraMessage  string
	CreateTime    time.Time
	UpdateTime    time.Time
}

func QueryRecord

func QueryRecord(dataFile string, masterUserName, masterPassword string, recordNameKeyword string) ([]*DecodedRecord, error)

QueryRecord 查询record,仅仅用于展示

type DecodedUser

type DecodedUser struct {
	Name        string
	Description string
	Password    string
	CreateTime  time.Time
	UpdateTime  time.Time
}

type User

type User struct {
	ID          int64     `gorm:"PRIMARY_KEY;AUTO_INCREMENT"`
	Name        string    `gorm:"size:255;index;not null;unique"`
	Description string    `gorm:"size:255"`
	Salt        string    `gorm:"size:255;not null;"`
	PassToken   string    `gorm:"size:255"`
	CreateTime  time.Time `gorm:"type:datetime"`
	UpdateTime  time.Time `gorm:"type:datetime"`
}

func (User) TableName

func (User) TableName() string

Jump to

Keyboard shortcuts

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