github.com/condensat/bank-core@v0.1.0/database/model/withdraw.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 import ( 8 "time" 9 ) 10 11 type WithdrawID ID 12 type BatchMode String 13 type WithdrawData String 14 15 const ( 16 BatchModeInstant BatchMode = "instant" 17 BatchModeFast BatchMode = "fast" 18 BatchModeNormal BatchMode = "normal" 19 BatchModeSlow BatchMode = "slow" 20 ) 21 22 type Withdraw struct { 23 ID WithdrawID `gorm:"primary_key"` 24 Timestamp time.Time `gorm:"index;not null;type:timestamp"` // Creation timestamp 25 From AccountID `gorm:"index;not null"` // [FK] Reference to Account table 26 To AccountID `gorm:"index;not null"` // [FK] Reference to Account table 27 Amount ZeroFloat `gorm:"default:0;not null"` // Operation amount (can not be negative) 28 Batch BatchMode `gorm:"index;not null;size:16"` // BatchMode [instant, fast, normal, slow] 29 Data WithdrawData `gorm:"type:blob;not null;default:'{}'"` // Withdraw data 30 }