datamodel

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

maps for user owner type

Functions

func DBUser2PBUser

func DBUser2PBUser(dbUser *User) (*mgmtPB.User, error)

DBUser2PBUser converts a database user instance to proto user

Types

type Base

type Base struct {
	UID        uuid.UUID `gorm:"type:uuid;primary_key;<-:create"` // allow read and create, but not update
	CreateTime time.Time `gorm:"autoCreateTime:nano;<-:create"`   // allow read and create, but not update
	UpdateTime time.Time `gorm:"autoUpdateTime:nano"`
}

Base contains common columns for all tables

type User

type User struct {
	Base
	ID                     string `gorm:"unique;not null;"`
	OwnerType              sql.NullString
	Email                  string `gorm:"unique;not null;"`
	Plan                   sql.NullString
	BillingId              sql.NullString
	FirstName              sql.NullString
	LastName               sql.NullString
	OrgName                sql.NullString
	Role                   sql.NullString
	NewsletterSubscription bool `gorm:"default:false"`
	CookieToken            sql.NullString
}

User defines a user instance in the database

func PBUser2DBUser

func PBUser2DBUser(pbUser *mgmtPB.User) (*User, error)

PBUser2DBUser converts a proto user instance to database user

Jump to

Keyboard shortcuts

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