db

package
v0.0.0-...-a26456e Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

包 db 包含共用的sql操作方法

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCKKSKeyTable

func CreateCKKSKeyTable() string

CreateCKKSKeyTable 新的 CKKS 公钥表

func CreateECDSAKeyTable

func CreateECDSAKeyTable() string

createECDSAKeyChainsTable 创建新的ECDSA公钥表

func CreateSwitchingKeyTable

func CreateSwitchingKeyTable() string

table SwitchingKey uuid TEXT PRIMARY KEY userIn TEXT, as FOREIGN KEY Users(uuid) userOut TEXT, as FOREIGN KEY to Users(uuid) pkIn, pkOut BLOB, as FOREIGN KEY to CKKSKeyChains(uuid) SwitchingKey BLOB

func CreateTransactionTable

func CreateTransactionTable() string

table Transactions

func CreateUserTable

func CreateUserTable() string

table Users: uuid TEXT PRIMARY KEY, userName TEXT balance BLOB <- []byte 被 rlwe.CipherText.Marshall编码 primary{ECDSA, CKKS}Key <- uuid, TEXT

func GetCKKSKeyByUserUUID

func GetCKKSKeyByUserUUID(db *sql.DB, UserUUID uuid.UUID) (keyChain *key.CKKSKeyChain, err error)

func GetECDSAKeyByUserUUID

func GetECDSAKeyByUserUUID(db *sql.DB, UserUUID uuid.UUID) (keyChain *key.ECDSAKeyChain, err error)

func GetSwitchingKeyPKInPKOut

func GetSwitchingKeyPKInPKOut(db *sql.DB, pkIDIn, pkIDOut uuid.UUID) (swk *rlwe.SwitchingKey, err error)

func GetSwitchingKeyUserIDInOut

func GetSwitchingKeyUserIDInOut(db *sql.DB, UserIDIn, UserIDOut uuid.UUID) (swk *rlwe.SwitchingKey, err error)

func GetTransaction

func GetTransaction(db *sql.DB, txUUID uuid.UUID) (tx *transaction.Transaction, err error)

func GetUser

func GetUser(db *sql.DB, UserUUID uuid.UUID) (user *users.User, err error)

func GetUserBalance

func GetUserBalance(db *sql.DB, UserUUID uuid.UUID) (balance *rlwe.Ciphertext, err error)

查询用户余额

func PutCKKSPublicKeyColumn

func PutCKKSPublicKeyColumn(db *sql.DB, keyID, userID uuid.UUID, pk *rlwe.PublicKey) (err error)

PutCKKSPublicKeyColumn 创建新的CKKS公钥行

func PutECDSAPublicKeyColumn

func PutECDSAPublicKeyColumn(db *sql.DB, keyID, userID uuid.UUID, pk *ecdsa.PublicKey) (err error)

PutECDSAPublicKeyColumn 创建新的ECDSA公钥行

func PutSwitchingKeyColumnByUserInUserOut

func PutSwitchingKeyColumnByUserInUserOut(db *sql.DB, keyID, userIn, userOut uuid.UUID, swk *rlwe.SwitchingKey) (err error)

PutSwitchingKeyColumnByUserInUserOut 创建新的SwitchingKey行

func PutUserColumn

func PutUserColumn(db *sql.DB, u *users.User, balance *rlwe.Ciphertext) (err error)

添加新的用户

func UpdateBalance

func UpdateBalance(db *sql.DB, userUUID uuid.UUID, balance *rlwe.Ciphertext) (err error)

UpdateBalance 更新数据库中用户余额

func WriteTransaction

func WriteTransaction(db *sql.DB, tx *transaction.Transaction) (err error)

WriteTransaction 将交易写入/更新至数据库

Types

This section is empty.

Jump to

Keyboard shortcuts

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