db

package
v0.0.0-...-e21c0d3 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateBunDB

func CreateBunDB(dsn string, waitForDB time.Duration) (*bun.DB, error)

func Migrate

func Migrate(ctx context.Context, db *bun.DB) error

Types

type DeviceDeliveryMechanism

type DeviceDeliveryMechanism struct {
	bun.BaseModel `bun:"table:device_delivery_mechanisms"`

	ID             int64                            `bun:",pk,autoincrement"`
	CreatedAt      time.Time                        `bun:"created_at,notnull,default:current_timestamp"`
	UpdatedAt      time.Time                        `bun:"updated_at,notnull,default:current_timestamp"`
	InstallationId string                           `bun:"installation_id,notnull,unique:group"`
	Installation   Installation                     `bun:"rel:belongs-to,join:installation_id=id"`
	Kind           interfaces.DeliveryMechanismKind `bun:"kind,notnull,unique:group"`
	Token          string                           `bun:"token,notnull,unique:group"`
}

type Installation

type Installation struct {
	bun.BaseModel `bun:"table:installations,select:installations"`

	Id                 string                     `bun:",pk"`
	CreatedAt          time.Time                  `bun:"created_at,notnull,default:current_timestamp"`
	DeletedAt          *time.Time                 `bun:"deleted_at"`
	DeliveryMechanisms []*DeviceDeliveryMechanism `bun:"rel:has-many,join:id=installation_id"`
}

type Subscription

type Subscription struct {
	bun.BaseModel `bun:"table:subscriptions"`

	Id             int64                   `bun:",pk,autoincrement"`
	CreatedAt      time.Time               `bun:"created_at,notnull,default:current_timestamp"`
	InstallationId string                  `bun:"installation_id,notnull"`
	Topic          string                  `bun:"topic,notnull"`
	IsActive       bool                    `bun:"is_active,notnull"`
	IsSilent       bool                    `bun:"is_silent,notnull"`
	HmacKeys       []*SubscriptionHmacKeys `bun:"rel:has-many,join:id=subscription_id"`
}

type SubscriptionHmacKeys

type SubscriptionHmacKeys struct {
	bun.BaseModel              `bun:"table:subscription_hmac_keys"`
	SubscriptionId             int64     `bun:"subscription_id,notnull,pk"`
	ThirtyDayPeriodsSinceEpoch int32     `bun:"thirty_day_periods_since_epoch,notnull,pk"`
	Key                        []byte    `bun:"key,notnull,type:bytea"`
	CreatedAt                  time.Time `bun:"created_at,notnull"`
	UpdatedAt                  time.Time `bun:"updated_at,notnull,default:current_timestamp"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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