You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: model.go
    path of file: ./repos/ZeroBot-Plugin/plugin/score
    
    the code of the file until where you have to start completion: package score

import (
	"os"
	"time"

	"github.com/jinzhu/gorm"
)

// sdb 得分数据库
var sdb *scoredb

// scoredb 分数数据库
type scoredb gorm.DB

// scoretable 分数结构体
type scoretable struct {
	UID   int64 `gorm:"column:uid;primary_key"`
	Score int   `gorm:"column:score;default:0"`
}

// TableName ...
func (scoretable) TableName() string {
	return "score"
}

// signintable 签到结构体
type signintable struct {
	UID       int64 `gorm:"column:uid;primary_key"
    
func (sdb *scoredb) InsertOrUpdateScoreByUID(uid int64, score int) (err error) {
	db := (*gorm.DB)(sdb)
	s := scoretable{
		UID:   uid,
		Score: score,
	}
	if err = db.Model(&scoretable{}).First(&s, "uid = ? ", uid).Error; err != nil {
		// error handling...
		if gorm.IsRecordNotFoundError(err) {
			err = db.Model(&scoretable{}).Create(&s).Error // newUser not user
		}
	} else {
		err = db.Model(&scoretable{}).Where("uid = ? ", uid).Update(
			map[string]any{
				"score": score,
			}).Error
	}
	return
}