model

package
v0.0.0-...-f46f3e0 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ModelColumnNames = modelColumnNames{
	CreatedAt: "created_at",
	DeletedAt: "deleted_at",
	ID:        "id",
	UpdatedAt: "updated_at",
}

Column names of the fields belonging to gorm.Model.

View Source
var UserColumnNames = userColumnNamesType{
	AvatarURL: "avatar_url",
	Email:     "email",
	FirstName: "first_name",
	Google: thirdPartyIdentityColumnNames{
		AccessToken:       "google_access_token",
		AccessTokenSecret: "google_access_token_secret",
		Email:             "google_email",
		ExpiresAt:         "google_expires_at",
		IDToken:           "google_id_token",
		UserID:            "google_user_id",
		RefreshToken:      "google_refresh_token",
	},
	LastName: "last_name",
	// contains filtered or unexported fields
}

Column names of the fields belonging to User.

Functions

This section is empty.

Types

type ThirdPartyIdentity

type ThirdPartyIdentity struct {
	// String that an OAuth client can use to make requests of the 3rd-party
	// authentication provider.
	//
	// For more, see https://oauth.net/2/access-tokens/.
	AccessToken *string
	// String that sort of acts as the "password" that should be used in
	// conjunction with AccessToken.
	//
	// For more, see https://stackoverflow.com/questions/28057430/what-is-the-access-token-vs-access-token-secret-and-consumer-key-vs-consumer-s.
	AccessTokenSecret *string
	// User email associated with the 3rd-party authentication provider.
	Email *string
	// When AccessToken expires.
	ExpiresAt *time.Time
	// JWT-like string that encodes all of the user's authentication metadata for
	// the 3rd-party authentication provider.
	//
	// For more, see https://www.oauth.com/oauth2-servers/openid-connect/id-tokens/.
	IDToken *string
	// Token that can be used to refresh AccessToken.
	//
	// For more, see https://auth0.com/blog/refresh-tokens-what-are-they-and-when-to-use-them/.
	RefreshToken *string
	// Uniquely identifies the User with the 3rd-party authentication provider.
	UserID *string `gorm:"unique"`
}

Relates a particular user to a 3rd-party authentication provider.

This struct is designed to be embedded within other database models.

type User

type User struct {
	gorm.Model

	// URL to a picture of the user.
	//
	// If nil, no such URL exists.
	AvatarURL *string `gorm:"unique"`
	// Unique email address of the user.
	Email string `gorm:"unique"`
	// First name of the user.
	FirstName string
	// Google identity information of this user.
	Google ThirdPartyIdentity `gorm:"embedded;embeddedPrefix:google_"`
	// Last name of the user.
	LastName string
}

Database model representing an individual user.

Jump to

Keyboard shortcuts

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