accounts/account/sql/embed.go
cloudneutral 53dbd235c4 Fix account module path (#751)
* Fix module path for account service

* Restructure account module path
2025-12-06 10:32:31 +08:00

26 lines
371 B
Go

package schema
import (
"crypto/sha256"
_ "embed"
"encoding/hex"
"sync"
)
//go:embed schema.sql
var schemaFile []byte
var (
hashOnce sync.Once
hash string
)
// Hash returns the SHA-256 hash of the canonical schema.sql file.
func Hash() string {
hashOnce.Do(func() {
sum := sha256.Sum256(schemaFile)
hash = hex.EncodeToString(sum[:])
})
return hash
}