cockroachdb

package
v0.0.0-...-db4ab52 Latest Latest
Warning

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

Go to latest
Published: May 15, 2019 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.

func New

func New(host, network, sslRootCert, sslCert, sslKey, encryptionKey string) (*cockroachdb, error)

New opens a connection to the CockroachDB user database and returns a new cockroachdb context. sslRootCert, sslCert, sslKey, and encryptionKey are file paths.

func UseLogger

func UseLogger(logger slog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using slog.

Types

type Identity

type Identity struct {
	PublicKey   string    `gorm:"primary_key;size:64"` // ed25519 public key
	UserID      uuid.UUID `gorm:"not null"`            // User UUID (User foreign key)
	Activated   int64     `gorm:"not null"`            // UNIX timestamp of activation
	Deactivated int64     `gorm:"not null"`            // UNIX timestamp of deactivation
}

Identity represents a user identity.

func (Identity) TableName

func (Identity) TableName() string

TableName returns the table name of the Identity table.

type KeyValue

type KeyValue struct {
	Key   string `gorm:"primary_key"`
	Value []byte `gorm:"not null"`
}

KeyValue store is a generic key-value store.

func (KeyValue) TableName

func (KeyValue) TableName() string

TableName returns the table name of the KeyValue table.

type User

type User struct {
	ID         uuid.UUID  `gorm:"primary_key"`       // UUID
	Username   string     `gorm:"not null;unique"`   // Unique username
	Identities []Identity `gorm:"foreignkey:UserID"` // User identity history
	Blob       []byte     `gorm:"not null"`          // Encrypted blob of user data

	// Set by gorm
	CreatedAt time.Time // Time of record creation
	UpdatedAt time.Time // Time of last record update
}

User represents a politeiawww user. Blog is an encrypted blob of the full user object.

func (User) TableName

func (User) TableName() string

TableName returns the table name of the User table.

Jump to

Keyboard shortcuts

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