github.com/condensat/bank-core@v0.1.0/database/model/oauth.go (about)

     1  // Copyright 2020 Condensat Tech. All rights reserved.
     2  // Use of this source code is governed by a MIT
     3  // license that can be found in the LICENSE file.
     4  
     5  package model
     6  
     7  type OAuth struct {
     8  	ID         ID     `gorm:"primary_key"`                                            // [PK] OAuth
     9  	Provider   string `gorm:"unique_index:idx_prov_provid;not null;type:varchar(16)"` // [U] Provider name
    10  	ProviderID string `gorm:"unique_index:idx_prov_provid;not null;type:varchar(64)"` // [U] Provider unique ID (from goth User.UserID)
    11  	UserID     UserID `gorm:"index;not null"`                                         // [FK] Reference to User table. Same user can have multiple providers
    12  }
    13  
    14  type OAuthData struct {
    15  	OAuthID ID     `gorm:"unique_index;not null"`           // [FK] Reference to OAuth table
    16  	Data    string `gorm:"type:json;not null;default:'{}'"` // goth User json data
    17  }