package main import ( "os" "path/filepath" "testing" "test/database/models/qvyun_v2/public/table" . "github.com/go-jet/jet/v2/postgres" . "github.com/smartystreets/goconvey/convey" "github.com/spf13/afero" ) func Test_Join(t *testing.T) { t1 := table.Medias t2 := table.UserMedias stmt := SELECT(t1.AllColumns). FROM( t1.RIGHT_JOIN(t2, t2.UserID.EQ(Int64(10)).AND(t2.TenantID.EQ(Int64(1)).AND(t2.MediaID.EQ(t1.ID)))), ) t.Log(stmt.DebugSql()) } func Test_Afero(t *testing.T) { Convey("Test afero", t, func() { fs := afero.NewBasePathFs(afero.NewOsFs(), "/tmp") path := "test/a/b/c/test.txt" err := fs.MkdirAll(filepath.Dir(path), os.ModePerm) So(err, ShouldBeNil) f, err := fs.OpenFile(path, os.O_CREATE|os.O_RDWR, 0o644) So(err, ShouldBeNil) f.Write([]byte("hello ")) f.Write([]byte("world")) f.Close() ff, err := fs.Open(path) So(err, ShouldBeNil) b := make([]byte, 1024) n, err := ff.Read(b) So(err, ShouldBeNil) So(string(b[:n]), ShouldEqual, "hello world") }) }