package main import ( "mime" "testing" "exporter/database/telegram_resource/public/table" "github.com/dustin/go-humanize" . "github.com/go-jet/jet/v2/postgres" "github.com/spf13/viper" ) func Test_Mime(t *testing.T) { // Test code here m := "application/rar" m = "video/mp4" t.Log(mime.ExtensionsByType(m)) } func Test_Size(t *testing.T) { // Test code here s := 6456390 t.Logf("Size: %d", s) t.Logf("Human: %s", humanize.Bytes(uint64(s))) viper.Set("size", "20MB") b := viper.GetSizeInBytes("size") t.Logf("Size: %d", s) t.Logf("Vize: %d", b) } func Test_Sql(t *testing.T) { tbl := table.ChannelMessages stmt := tbl.UPDATE().SET( tbl.Content.SET(RawString(`CONCAT(content, $var)`, RawArgs{"$var": "hello"})), tbl.Media.SET(RawString(`media || $var::jsonb`, RawArgs{"$var": `{"Rogee": "Hello"}`})), ).WHERE( tbl.GroupID.EQ(Int(1)).AND( tbl.UUID.EQ(Int64(1)), ), ) t.Log(stmt.DebugSql()) }