Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // SurrealDBRepo is the repository name of SurrealDB image. // // If you would like to use some other version, you can update this variable // to point to the image you want to use. SurrealDBRepo = "surrealdb/surrealdb" //SurrealDBTag is the tag of SurrealDB image. // // If you would like to use some other version, you can update this variable // to point to the image you want to use. SurrealDBTag = "1.0.0" )
Functions ¶
func NewSurrealDBRaw ¶
NewSurrealDBRaw creates a Docker container with SurrealDB, and returns the host:port of the SurrealDB instance. Clean up function is returned as well to ensure container gets removed after test is complete.
This function is intended to be used with password "root", and requires manual namespace and database handling. While this may be tedious and you may be better off using NewSurrealDB instead, this function is useful for testing more complex scenarios.
func SmartUnmarshalAll ¶
Temporarily placed here, PR is created for upstream surrealdb. Ref: https://github.com/surrealdb/surrealdb.go/pull/79
Types ¶
type RawQuery ¶
type RawQuery[I any] struct { Status string `json:"status"` Time string `json:"time"` Result I `json:"result"` Detail string `json:"detail"` }
Used for RawQuery Unmarshaling
type SurrealDBTest ¶
type SurrealDBTest struct { *surrealdb.DB // contains filtered or unexported fields }
func NewSurrealDB ¶
func NewSurrealDB(t testing.TB) (*SurrealDBTest, func())
NewSurrealDB creates a Docker container with SurrealDB, and returns SurrealDB DB connection wrapped in SurrealDBTest struct. Clean up function is returned as well to ensure container gets removed after test is complete.
This function assumse the use of "test" namespace and "testdatabase.
func (*SurrealDBTest) Prepare ¶
func (s *SurrealDBTest) Prepare(t testing.TB, schema string)
Prepare allows creating tables with the target database. The schema input can contain any number of SurrealQL expressions, including data creation, changing namespace and database, etc. If you are to provide multiple statements, make sure to separate them with a semicolon.