dbmodel

package
v0.0.0-...-d357a17 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2023 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TableNameGenerator

func TableNameGenerator(name string) string

Types

type KeyModel

type KeyModel struct {
	PrimaryModel
	ExternalId   *string        `json:"external_id" gorm:"uniqueIndex"`
	PrivateKey   string         `json:"private_key"`
	PublicKey    string         `json:"public_key"`
	Kid          string         `json:"kid"`
	JWK          datatypes.JSON `json:"jwk" gorm:"type:jsonb"`
	ShouldRotate *bool          `json:"should_rotate" gorm:"default:false"`
	RotateCron   *string        `json:"rotate_cron"`
	ExpiresAt    *time.Time     `json:"expires_at" gorm:"index"`
	TimesModel
}

func (*KeyModel) BeforeCreate

func (k *KeyModel) BeforeCreate(db *gorm.DB) error

func (*KeyModel) GenerateJWK

func (k *KeyModel) GenerateJWK() error

func (*KeyModel) GenerateKeys

func (k *KeyModel) GenerateKeys(bits *int32) error

func (*KeyModel) JWKMap

func (k *KeyModel) JWKMap() map[string]interface{}

func (*KeyModel) NextExpirationDate

func (k *KeyModel) NextExpirationDate() *time.Time

func (*KeyModel) TableName

func (*KeyModel) TableName() string

type KeyRotatedModel

type KeyRotatedModel struct {
	PrimaryModel
	KeyId      string         `json:"key" gorm:"index"`
	PrivateKey string         `json:"private_key" gorm:"uniqueIndex"`
	PublicKey  string         `json:"public_key" gorm:"uniqueIndex"`
	Kid        string         `json:"kid"`
	JWK        datatypes.JSON `json:"jwk" gorm:"type:jsonb"`
	ExpiresAt  *time.Time     `json:"expires_at" gorm:"index"`
	TimesModel
}

func (*KeyRotatedModel) JWKMap

func (k *KeyRotatedModel) JWKMap() map[string]interface{}

func (*KeyRotatedModel) TableName

func (*KeyRotatedModel) TableName() string

type PrimaryModel

type PrimaryModel struct {
	ID string `gorm:"primaryKey; type:text;" json:"id" swaggertype:"string"`
}

func (*PrimaryModel) BeforeCreate

func (main *PrimaryModel) BeforeCreate(db *gorm.DB) error

func (*PrimaryModel) BeforeSave

func (main *PrimaryModel) BeforeSave(db *gorm.DB) error

type TimesModel

type TimesModel struct {
	CreatedAt time.Time       `json:"created_at" gorm:"index;autoCreateTime" swaggertype:"string"`
	UpdatedAt time.Time       `json:"updated_at" gorm:"index;autoUpdateTime" swaggertype:"string"`
	DeletedAt types.DeletedAt `json:"deleted_at" gorm:"index;default:null" swaggertype:"string"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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