dao

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

* Copyright (c) 2019. Baidu Inc. All Rights Reserved.

* Copyright (c) 2019. Baidu Inc. All Rights Reserved.

* Copyright (c) 2019. Baidu Inc. All Rights Reserved.

* Copyright (c) 2019. Baidu Inc. All Rights Reserved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitTables

func InitTables()

DB目前仅支持sqlite3, ca启动时会校验是否存在sqlite3 db文件, 如果db不存在则自动创建

Types

type CaDb

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

func GetDbInstance

func GetDbInstance() *CaDb

func NewCaDb

func NewCaDb() (connection *CaDb)

type NetAdmin

type NetAdmin struct {
	Id           int    `db:"id"`
	Net          string `db:"net"`
	Address      string `db:"address"`
	SerialNum    string `db:"serial_num"`
	Cert         string `db:"cert"`
	PrivateKey   string `db:"private_key"`
	CreateTime   int    `db:"create_time"`
	UpdateTime   int    `db:"update_time"`
	IsValid      bool   `db:"is_valid"`
	ValidTime    int    `db:"valid_time"`
	HdPrivateKey string `db:"hd_private_key"`
}

type NetAdminDao

type NetAdminDao struct {
}

ca内的网络管理数据层

func (*NetAdminDao) GetNetAdmin

func (netAdminDao *NetAdminDao) GetNetAdmin(net, adminAddress string) *NetAdmin

func (*NetAdminDao) Insert

func (netAdminDao *NetAdminDao) Insert(netAdmin *NetAdmin) (int64, error)

type Node

type Node struct {
	Id           int    `db:"id"`
	Net          string `db:"net"`
	AdminAddress string `db:"adminAddress"`
	Address      string `db:"address"`
	SerialNum    string `db:"serial_num"`
	Cert         string `db:"cert"`
	PrivateKey   string `db:"private_key"`
	CreateTime   int    `db:"create_time"`
	UpdateTime   int    `db:"update_time"`
	IsValid      bool   `db:"is_valid"`
	ValidTime    int    `db:"valid_time"`
	HdPrivateKey string `db:"hd_private_key"`
}

type NodeDao

type NodeDao struct {
}

ca网络下的节点管理数据层

func (*NodeDao) Insert

func (nodeDao *NodeDao) Insert(node *Node) (int64, error)

func (*NodeDao) QueryTotalNode

func (nodeDao *NodeDao) QueryTotalNode(net, adminAddress string) (uint32, error)

func (*NodeDao) QueryValidNodeByNetAndAddress

func (nodeDao *NodeDao) QueryValidNodeByNetAndAddress(net, address string) *Node

func (*NodeDao) QueryValidNodeByNetAndAdmin

func (nodeDao *NodeDao) QueryValidNodeByNetAndAdmin(net, adminAddress string) *Node

func (*NodeDao) RevokeNodeByNetAndAddress

func (nodeDao *NodeDao) RevokeNodeByNetAndAddress(net, address string) (bool, error)

type Revoke

type Revoke struct {
	Id         int    `db:"id"`
	Net        string `db:"net"`
	SerialNum  string `db:"serial_num"`
	CreateTime int    `db:"create_time"`
}

type RevokeDao

type RevokeDao struct {
}

ca网络下的撤销列表数据层

func (*RevokeDao) GetList

func (revokeDao *RevokeDao) GetList(net, latestSerialNum string) (*[]Revoke, error)

cursor

Jump to

Keyboard shortcuts

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