Documentation
¶
Index ¶
- Variables
- func Decrypt(ciphertext []byte, key []byte, iv []byte) ([]byte, error)
- func DecryptToString(ciphertext string, key []byte, iv []byte) (string, error)
- func Encrypt(plaintext []byte, key []byte, iv []byte) ([]byte, error)
- func EncryptToString(plaintext string, key []byte, iv []byte) (string, error)
- func GenID() int64
- func InitSnowFlakeId(startTime string, machineID int64) (err error)
- func InitSqlite(uri string)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func TestAES()
- type Account
- type AccountMapper
- type AccountService
- func (as *AccountService) Delete(id int64)
- func (as *AccountService) Get(id int64) Account
- func (as *AccountService) Init(sqlEngine GoMybatis.GoMybatisEngine)
- func (as *AccountService) List(platformId int64, username string, phone string, email string, page int, ...) []Account
- func (as *AccountService) PageList(platformId int64, username string, phone string, email string, page int, ...) PageData[Account]
- func (as *AccountService) Save(entity Account) *Account
- func (as *AccountService) Update(entity Account) Account
- func (as *AccountService) UpdatePwd(id int64, newPassword string) bool
- type AesInfo
- type DbOp
- type EntityType
- type PageData
- type Platform
- type PlatformMapper
- type PlatformService
- func (ps *PlatformService) Delete(id int64)
- func (ps *PlatformService) Get(id int64) Platform
- func (ps *PlatformService) Init(sqlEngine GoMybatis.GoMybatisEngine)
- func (ps *PlatformService) List(name string, page int, size int) []Platform
- func (ps *PlatformService) PageList(name string, page int, size int) PageData[Platform]
- func (ps *PlatformService) Save(entity Platform) Platform
- func (ps *PlatformService) Update(entity Platform) Platform
- type PwdTool
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var PlatformMapperXml []byte
View Source
var SqlEngine GoMybatis.GoMybatisEngine
var uri string = "file:D:\\eclipse\\2022-06-R\\workspace\\pwdbox.db3"
View Source
var SqliteInited bool = false // 数据库是否初始化成功
Functions ¶
func DecryptToString ¶
func EncryptToString ¶
func InitSnowFlakeId ¶
Types ¶
type Account ¶
type Account struct {
Id int64 `json:"id"`
PlatformId int64 `json:"platform_id"` // 平台
Username string `json:"username"` // 用户名
Password string `json:"password"` // 密码
Phone string `json:"phone"` // 绑定电话(多个,隔开)
Email string `json:"email"` // 绑定邮箱(多个,隔开)
Remark string `json:"remark"` // 备注
CreateTime string `json:"create_time"` // 创建时间
}
账户实体
type AccountMapper ¶
type AccountMapper struct {
Get func(id int64) (Account, error) `args:"id"`
Update func(p Account) error
Save func(p Account) error
Delete func(id int64) error `args:"id"`
// MaxNum func() (int, error) // maybe nil
Count func(platformId int64, username string, phone string, email string) (int, error) `args:"platform_id,username,phone,email"`
List func(platformId int64, username string, phone string, email string,
start int, offset int) ([]Account, error) `args:"platform_id,username,phone,email,start,offset"`
}
type AccountService ¶
type AccountService struct {
IsCreated bool // 是否初始化完成(链接数据库)
}
var AccountServiceInstance AccountService
用单例吧
func (*AccountService) Delete ¶
func (as *AccountService) Delete(id int64)
func (*AccountService) Get ¶
func (as *AccountService) Get(id int64) Account
func (*AccountService) Init ¶
func (as *AccountService) Init(sqlEngine GoMybatis.GoMybatisEngine)
func (*AccountService) Save ¶
func (as *AccountService) Save(entity Account) *Account
func (*AccountService) Update ¶
func (as *AccountService) Update(entity Account) Account
type EntityType ¶
type PageData ¶
type PageData[T EntityType] struct { Page int Size int Total int Data []T }
func EmptyPageData ¶
func EmptyPageData[T EntityType]() PageData[T]
func NewPageData ¶
func NewPageData[T EntityType](page int, size int, total int, list []T) PageData[T]
type Platform ¶
type Platform struct {
Id int64 `json:"id"`
Name string `json:"name"` // 平台名称
Site string `json:"site"` // 官网
Remark string `json:"remark"` // 备注
Num int `json:"num"` // 序号
// CreateTime time.Time `json:"create_time"` // 创建时间
CreateTime string `json:"create_time"` // 创建时间
Img string `json:"img"` // 图片
}
平台实体
type PlatformMapper ¶
type PlatformMapper struct {
Get func(id int64) (Platform, error) `args:"id"`
Update func(p Platform) error
Save func(p Platform) error
Delete func(id int64) error `args:"id"`
MaxNum func() (int, error) // maybe nil
Count func(name string) (int, error) `args:"name"`
List func(name string, start int, offset int) ([]Platform, error) `args:"name,start,offset"`
}
var PlatformMapperInstance PlatformMapper
type PlatformService ¶
type PlatformService struct {
IsCreated bool // 是否初始化完成(链接数据库)
}
var PlatformServiceInstance PlatformService
用单例吧
func (*PlatformService) Delete ¶
func (ps *PlatformService) Delete(id int64)
func (*PlatformService) Get ¶
func (ps *PlatformService) Get(id int64) Platform
func (*PlatformService) Init ¶
func (ps *PlatformService) Init(sqlEngine GoMybatis.GoMybatisEngine)
func (*PlatformService) List ¶
func (ps *PlatformService) List(name string, page int, size int) []Platform
func (*PlatformService) Save ¶
func (ps *PlatformService) Save(entity Platform) Platform
func (*PlatformService) Update ¶
func (ps *PlatformService) Update(entity Platform) Platform
type Service ¶
type Service interface {
Init(sqlEngine GoMybatis.GoMybatisEngine) // 初始化
}
Click to show internal directories.
Click to hide internal directories.