entities

package
v0.0.0-...-12bf87c Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2023 License: MPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnalyticsProviderGoogle  = "google"
	AnalyticsProviderWebhook = "webhook"
	AnalyticsProviderMatomo  = "matomo"
)
View Source
const (
	EngineProviderCloudflareWorkers = "cloudflare-workers"
	EngineProviderAmazonS3          = "aws-s3"
	EngineProviderStandalone        = "standalone"
)

Variables

This section is empty.

Functions

func UserRoleKey

func UserRoleKey(domainId DomainID, userId UserID) map[string]ddbTypes.AttributeValue

Types

type Domain

type Domain struct {
	// core data
	Id            DomainID `json:"id"                       dynamodbav:"id"`
	Domain        string   `json:"domain"                   dynamodbav:"domain"`
	Description   *string  `json:"description,omitempty"    dynamodbav:"description,omitempty"`
	DefaultTarget *string  `json:"default_target,omitempty" dynamodbav:"default_target,omitempty"`

	// engine config
	Engine EngineConfig `json:"engine" dynamodbav:"engine"`

	// meta
	CreatedAt timestamp.Timestamp `json:"created_at"               dynamodbav:"created_at"`
	UpdatedAt timestamp.Timestamp `json:"updated_at"               dynamodbav:"updated_at"`
	UserRole  string              `json:"user_role,omitempty"      dynamodbav:"-"` // not stored in dynamo
}

*

  • entity

func NewDomain

func NewDomain() *Domain

func (*Domain) MarshalDynamoAV

func (domain *Domain) MarshalDynamoAV() (map[string]ddbTypes.AttributeValue, error)

func (*Domain) UnmarshalDynamoAV

func (domain *Domain) UnmarshalDynamoAV(item map[string]ddbTypes.AttributeValue) error

type DomainID

type DomainID = string

type Engine

type Engine struct {
	Features EngineFeatures `json:"features"  dynamodbav:"features"`
	ID       string         `json:"id"        dynamodbav:"id"`
	Name     string         `json:"name"      dynamodbav:"name"`
	SyncPush bool           `json:"sync_push" dynamodbav:"sync_push"`
	SyncPull bool           `json:"sync_pull" dynamodbav:"sync_pull"`
	SyncCron bool           `json:"sync_cron" dynamodbav:"sync_cron"`
}

type EngineConfig

type EngineConfig struct {
	EngineID string `json:"engine_id" dynamodbav:"engine_id"`
	SyncMode string `json:"sync_mode" dynamodbav:"sync_mode"`

	// deployment
	EnableAutoDeploy bool                 `json:"enable_auto_deploy"         dynamodbav:"enable_auto_deploy"`
	TargetVersion    *string              `json:"target_version,omitempty"   dynamodbav:"target_version,omitempty"`
	DeployedVersion  *string              `json:"deployed_version,omitempty" dynamodbav:"deployed_version,omitempty"`
	DeployedAt       *timestamp.Timestamp `json:"deployed_at,omitempty"      dynamodbav:"deployed_at,omitempty"`
	TestedAt         *timestamp.Timestamp `json:"tested_at,omitempty"        dynamodbav:"tested_at,omitempty"`

	// redirection
	ErrorPassthrough  bool `json:"error_passthrough"  dynamodbav:"error_passthrough"`
	OpaqueRedirection bool `json:"opaque_redirection" dynamodbav:"opaque_redirection"`

	// analytics
	AnalyticsProvider string `json:"analytics_provider" dynamodbav:"analytics_provider"`
	WaitForAnalytics  bool   `json:"wait_for_analytics" dynamodbav:"wait_for_analytics"`
}

type EngineFeatures

type EngineFeatures struct {
	OpaqueRedirection bool `json:"opaque_redirect" dynamodbav:"opaque_redirect"`
	Analytics         bool `json:"analytics"       dynamodbav:"analytics"`
	AccessLogging     bool `json:"access_logging"  dynamodbav:"access_logging"`
	AutoDeploy        bool `json:"auto_deploy"     dynamodbav:"auto_deploy"`
}
type Link struct {
	DomainId  DomainID             `json:"domain_id"            dynamodbav:"domain_id"`
	URI       string               `json:"uri"                  dynamodbav:"uri"`
	Target    string               `json:"target"               dynamodbav:"target"`
	CreatedAt timestamp.Timestamp  `json:"created_at"           dynamodbav:"created_at"`
	UpdatedAt timestamp.Timestamp  `json:"updated_at"           dynamodbav:"updated_at"`
	ExpiresAt *timestamp.Timestamp `json:"expires_at,omitempty" dynamodbav:"expires_at"`
}
func NewLink() *Link

*

  • entity

func (*Link) Key

func (link *Link) Key() *LinkKey

func (*Link) MarshalDynamoAV

func (link *Link) MarshalDynamoAV() (map[string]ddbTypes.AttributeValue, error)

func (*Link) UnmarshalDynamoAV

func (link *Link) UnmarshalDynamoAV(item map[string]ddbTypes.AttributeValue) error

type LinkKey

type LinkKey struct {
	DomainId DomainID `dynamodbav:"domain_id"`
	URI      string   `dynamodbav:"uri"`
}

func NewLinkKey

func NewLinkKey(domainId string, uri string) *LinkKey

*

  • Key

func (*LinkKey) MarshalDynamoAV

func (linkKey *LinkKey) MarshalDynamoAV() (map[string]ddbTypes.AttributeValue, error)

func (*LinkKey) MarshalString

func (linkKey *LinkKey) MarshalString() (string, error)

func (*LinkKey) UnmarshalDynamoAV

func (linkKey *LinkKey) UnmarshalDynamoAV(item map[string]ddbTypes.AttributeValue) error

func (*LinkKey) UnmarshalString

func (linkKey *LinkKey) UnmarshalString(enc string) error
type Links []*Link

*

  • slice of entities

func (*Links) UnmarshalDynamoAV

func (links *Links) UnmarshalDynamoAV(items []map[string]ddbTypes.AttributeValue) error

type User

type User struct {
	Id       UserID `json:"id"             dynamodbav:"id"`
	Name     string `json:"name"           dynamodbav:"name"`
	Username string `json:"-"              dynamodbav:"username"`
	Nickname string `json:"nickname"       dynamodbav:"nickname"`
	Picture  string `json:"picture"        dynamodbav:"picture"`
	Role     string `json:"role,omitempty" dynamodbav:"-"` // not stored in same table as users
}

*

  • entity

func (*User) MarshalDynamoAV

func (user *User) MarshalDynamoAV() (map[string]ddbTypes.AttributeValue, error)

func (*User) UnmarshalDynamoAV

func (user *User) UnmarshalDynamoAV(item map[string]ddbTypes.AttributeValue) error

type UserID

type UserID = string

type UserInvite

type UserInvite struct {
	ID        UserInviteID        `json:"id"         dynamodbav:"id"`
	Email     string              `json:"email"      dynamodbav:"email"`
	Role      string              `json:"role"       dynamodbav:"role"`
	DomainID  DomainID            `json:"domain_id"  dynamodbav:"domain_id"`
	CreatedAt timestamp.Timestamp `json:"created_at" dynamodbav:"created_at"`
	ExpiresAt timestamp.Timestamp `json:"expires_at" dynamodbav:"expires_at"`
}

func NewUserInvite

func NewUserInvite() *UserInvite

func (*UserInvite) Expired

func (userInvite *UserInvite) Expired() bool

func (*UserInvite) MarshalDynamoAV

func (userInvite *UserInvite) MarshalDynamoAV() (map[string]ddbTypes.AttributeValue, error)

func (*UserInvite) UnmarshalDynamoAV

func (userInvite *UserInvite) UnmarshalDynamoAV(item map[string]ddbTypes.AttributeValue) error

type UserInviteID

type UserInviteID = string

*

  • entity

type UserInvites

type UserInvites []*UserInvite

*

  • slice of entities

func (*UserInvites) UnmarshalDynamoAV

func (userInvites *UserInvites) UnmarshalDynamoAV(items []map[string]ddbTypes.AttributeValue) error

type UserRole

type UserRole struct {
	DomainID  DomainID            `json:"domain_id"  dynamodbav:"domain_id"`
	UserID    string              `json:"user_id"    dynamodbav:"user_id"`
	RoleName  string              `json:"role_name"  dynamodbav:"role_name"`
	CreatedAt timestamp.Timestamp `json:"created_at" dynamodbav:"created_at"`
	UpdatedAt timestamp.Timestamp `json:"updated_at" dynamodbav:"updated_at"`
}

*

  • entity

func NewUserRole

func NewUserRole() *UserRole

func (*UserRole) MarshalDynamoAV

func (userRole *UserRole) MarshalDynamoAV() (map[string]ddbTypes.AttributeValue, error)

func (*UserRole) Role

func (userRole *UserRole) Role() permissions.Role

func (*UserRole) UnmarshalDynamoAV

func (userRole *UserRole) UnmarshalDynamoAV(item map[string]ddbTypes.AttributeValue) error

type UserRoles

type UserRoles []*UserRole

*

  • slice of entities

func (*UserRoles) FindByDomainID

func (userRoles *UserRoles) FindByDomainID(id DomainID) *UserRole

func (*UserRoles) FindByUserID

func (userRoles *UserRoles) FindByUserID(id UserID) *UserRole

func (*UserRoles) UnmarshalDynamoAV

func (userRoles *UserRoles) UnmarshalDynamoAV(items []map[string]ddbTypes.AttributeValue) error

type Users

type Users []*User

*

  • slice of entities

func (*Users) UnmarshalDynamoAV

func (users *Users) UnmarshalDynamoAV(items []map[string]ddbTypes.AttributeValue) error

Jump to

Keyboard shortcuts

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