Documentation
¶
Index ¶
- Variables
- func ConnectBq(projectId string, dataset string, googlecredentialfile string)
- func ConnectDatabase(dbUser string, dbPwd string, dbName string, dbTCPHost string, dbPort string) (*gorm.DB, error)
- func SetupCache() *cache.Cache
- type ClaimsJWT
- type Journey
- type Partner
- type PartnerLogin
- type Purchase
- type PurchaseReceipt
- type RowType
- type TokenRefresh
- type User
- type UserLogin
- type UserUpdate
- type Voucher
- type VoucherPurchased
Constants ¶
This section is empty.
Variables ¶
View Source
var APPLICATION_NAME = "Lesgo"
View Source
var BqCtx context.Context
View Source
var C *cache.Cache
View Source
var Client *bigquery.Client
View Source
var DATASET string
View Source
var Db *gorm.DB
View Source
var GOOGLE_APPLICATION_CREDENTIALS_FILE string
View Source
var JWT_SIGNATURE_KEY = []byte("15 besar")
View Source
var JWT_SIGNING_METHOD = jwt.SigningMethodHS256
View Source
var LOGIN_EXPIRATION_DURATION = 7 * 24 * time.Hour
View Source
var PROJECT_ID string
Functions ¶
func ConnectDatabase ¶
func SetupCache ¶
func SetupCache() *cache.Cache
Types ¶
type Journey ¶
type Journey struct { JourneyID string `json:"journeyId" gorm:"primaryKey"` UserID string `json:"userId" binding:"required" FK` StartTime time.Time `json:"startTime" binding:"required"` FinishTime time.Time `json:"finishTime" binding:"required"` Origin string `json:"origin" binding:"required"` Destination string `json:"destination" binding:"required"` DistanceTravelled float64 `json:"distanceTravelled" binding:"required"` EmissionSaved float64 `json:"emissionSaved" binding:"required"` Reward int `json:"reward" binding:"required"` }
type Partner ¶
type Partner struct { PartnerID string `json:"partnerId" gorm:"primaryKey"` PartnerName string `json:"partnerName" binding:"required"` Email string `json:"email" gorm:"unique" binding:"required"` Username string `json:"username" gorm:"unique" binding:"required"` Password string `json:"password" binding:"required"` Vouchers []Voucher `gorm:"foreignKey:PartnerID;references:PartnerID"` }
type PartnerLogin ¶
type Purchase ¶
type PurchaseReceipt ¶
type RowType ¶
type TokenRefresh ¶
type TokenRefresh struct {
Token string `json:"token"`
}
type User ¶
type User struct { UserID string `json:"userId" gorm:"primaryKey"` Email string `json:"email" gorm:"unique" binding:"required"` Username string `json:"username" gorm:"unique" binding:"required"` Password string `json:"password" binding:"required"` FirstName string `json:"firstName" binding:"required"` LastName string `json:"lastName" binding:"required"` BirthDate time.Time `json:"birthDate" binding:"required"` Age int `json:"age"` Gender string `json:"gender" gorm:"default:null"` Job string `json:"job" gorm:"default:null"` Points int `json:"points" gorm:"default:0"` VoucherInterest string `json:"voucherInterest" gorm:"default:null"` Domicile string `json:"domicile" gorm:"default:null"` Education string `json:"education" gorm:"default:null"` MarriageStatus bool `json:"marriageStatus" gorm:"default:null"` Income int `json:"income" gorm:"default:0"` Vehicle string `json:"vehicle" gorm:"default:null"` Journeys []Journey `gorm:"foreignKey:UserID;references:UserID"` }
type UserUpdate ¶
type UserUpdate struct { Job string `json:"job" gorm:"default:null"` VoucherInterest string `json:"voucherInterest" gorm:"default:null"` Domicile string `json:"domicile" gorm:"default:null"` Education string `json:"education" gorm:"default:null"` MarriageStatus bool `json:"marriageStatus" gorm:"default:null"` Income int `json:"income" gorm:"default:0"` Vehicle string `json:"vehicle" gorm:"default:null"` Gender string `json:"gender" gorm:"default:null"` }
type Voucher ¶
type Voucher struct { VoucherID string `json:"voucherId" gorm:"primaryKey"` PartnerID string `json:"partnerId" binding:"required"` PartnerName string `json:"partnerName" binding:"required"` VoucherName string `json:"voucherName" binding:"required"` VoucherDesc string `json:"voucherDesc" binding:"required"` Category string `json:"category" binding:"required"` ImageUrl string `json:"imageUrl" default:"https://storage.googleapis.com/voucher-images-2909/jco.jpg"` Stock int `json:"stock" binding:"required"` Price int `json:"price" binding:"required"` }
type VoucherPurchased ¶
type VoucherPurchased struct { gorm.Model VoucherID string UserID string IsPurchased bool `default:"false"` Voucher Voucher `gorm:"foreignKey:VoucherID;references:VoucherID"` User User `gorm:"foreignKey:UserID;references:UserID"` }
func (*VoucherPurchased) BeforeCreate ¶
func (voucherPurchased *VoucherPurchased) BeforeCreate(tx *gorm.DB) error
Click to show internal directories.
Click to hide internal directories.