package models

import (
	"slg/pkg/setting"
)

type Bank struct {
	id            uint32  `gorm:"type:int(11);primary key"`
	BankName      string `gorm:"type:varchar(64);not null"`
}

func (b Bank) TableName() string {
	return setting.DatabaseSetting.Name + ".bank"
}

func AddBank(data map[string]interface{}) (error) {
	bank := Bank{
		BankName:      data["bankname"].(string),
	}

	if err := db.Create(&bank).Error; err != nil {
		return err
	}

	return nil
}