Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion background_consumer.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down
6 changes: 3 additions & 3 deletions background_consumer_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand All @@ -13,7 +13,7 @@ type lazyReceiverEntity struct {
ID uint
Name string `orm:"unique=name"`
Age uint64
EnumNullable string `orm:"enum=beeorm.TestEnum"`
EnumNullable string `orm:"enum=trixorm.TestEnum"`
RefOne *lazyReceiverReference
IndexAll *CachedQuery `query:""`
}
Expand All @@ -29,7 +29,7 @@ func TestBackgroundConsumer(t *testing.T) {
var ref *lazyReceiverReference

registry := &Registry{}
registry.RegisterEnum("beeorm.TestEnum", []string{"a", "b", "c"})
registry.RegisterEnum("trixorm.TestEnum", []string{"a", "b", "c"})
engine, def := prepareTables(t, registry, 5, "", "2.0", entity, ref)
defer def()
engine.GetRedis().FlushDB()
Expand Down
2 changes: 1 addition & 1 deletion bind_builder.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
2 changes: 1 addition & 1 deletion cached_search.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
14 changes: 7 additions & 7 deletions cached_search_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down Expand Up @@ -226,7 +226,7 @@ func testCachedSearch(t *testing.T, localCache bool, redisCache bool) {
assert.PanicsWithError(t, "reference WrongReference in cachedSearchEntity is not valid", func() {
engine.CachedSearchWithReferences(&rows, "IndexAge", nil, []interface{}{10}, []string{"WrongReference"})
})
assert.PanicsWithError(t, "interface *beeorm.cachedSearchEntity is no slice of beeorm.Entity", func() {
assert.PanicsWithError(t, "interface *trixorm.cachedSearchEntity is no slice of trixorm.Entity", func() {
engine.CachedSearchWithReferences(entity, "IndexAge", nil, []interface{}{10}, []string{"WrongReference"})
})

Expand Down Expand Up @@ -269,11 +269,11 @@ func TestCachedSearchErrors(t *testing.T) {
engine, def := prepareTables(t, &Registry{}, 5, "", "2.0")
defer def()
var rows []*cachedSearchEntity
assert.PanicsWithError(t, "entity 'beeorm.cachedSearchEntity' is not registered", func() {
assert.PanicsWithError(t, "entity 'trixorm.cachedSearchEntity' is not registered", func() {
_ = engine.CachedSearch(&rows, "IndexAge", nil, 10)
})
var row cachedSearchEntity
assert.PanicsWithError(t, "entity 'beeorm.cachedSearchEntity' is not registered", func() {
assert.PanicsWithError(t, "entity 'trixorm.cachedSearchEntity' is not registered", func() {
_ = engine.CachedSearchOne(&row, "IndexName", 10)
})

Expand All @@ -295,12 +295,12 @@ func TestCachedSearchErrors(t *testing.T) {
})

var rows2 []*cachedSearchRefEntity
assert.PanicsWithError(t, "cache search not allowed for entity without cache: 'beeorm.cachedSearchRefEntity'", func() {
assert.PanicsWithError(t, "cache search not allowed for entity without cache: 'trixorm.cachedSearchRefEntity'", func() {
_ = engine.CachedSearch(&rows2, "IndexAll", nil, 10)
})

var row2 cachedSearchRefEntity
assert.PanicsWithError(t, "cache search not allowed for entity without cache: 'beeorm.cachedSearchRefEntity'", func() {
assert.PanicsWithError(t, "cache search not allowed for entity without cache: 'trixorm.cachedSearchRefEntity'", func() {
_ = engine.CachedSearchOne(&row2, "IndexName", 10)
})
}
Expand All @@ -309,7 +309,7 @@ func BenchmarkCachedSearch(b *testing.B) {
entity := &schemaEntity{}
ref := &schemaEntityRef{}
registry := &Registry{}
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
registry.RegisterLocalCache(10000)
engine, def := prepareTables(nil, registry, 5, "", "2.0", entity, ref)
defer def()
Expand Down
2 changes: 1 addition & 1 deletion clear_by_ids.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

func clearByIDs(engine *Engine, entity Entity, ids ...uint64) {
schema := initIfNeeded(engine.registry, entity).tableSchema
Expand Down
2 changes: 1 addition & 1 deletion db.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion db_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"database/sql"
Expand Down
2 changes: 1 addition & 1 deletion dirty_event.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

type DirtyEntityEvent interface {
ID() uint64
Expand Down
2 changes: 1 addition & 1 deletion dirty_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion engine.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion engine_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"testing"
Expand Down
2 changes: 1 addition & 1 deletion entity_redis_search.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
22 changes: 11 additions & 11 deletions entity_redis_search_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand All @@ -18,12 +18,12 @@ type redisSearchEntity struct {
Weight float64 `orm:"searchable"`
AgeNullable *uint64 `orm:"searchable;sortable"`
BalanceNullable *int64 `orm:"searchable;sortable"`
Enum string `orm:"enum=beeorm.TestEnum;required;searchable"`
EnumNullable string `orm:"enum=beeorm.TestEnum;searchable"`
Enum string `orm:"enum=trixorm.TestEnum;required;searchable"`
EnumNullable string `orm:"enum=trixorm.TestEnum;searchable"`
Name string `orm:"searchable"`
NameStem string `orm:"searchable;stem"`
Set []string `orm:"set=beeorm.TestEnum;required;searchable"`
SetNullable []string `orm:"set=beeorm.TestEnum;searchable"`
Set []string `orm:"set=trixorm.TestEnum;required;searchable"`
SetNullable []string `orm:"set=trixorm.TestEnum;searchable"`
Bool bool `orm:"searchable;sortable"`
BoolNullable *bool `orm:"searchable"`
WeightNullable *float64 `orm:"searchable"`
Expand Down Expand Up @@ -89,7 +89,7 @@ func TestEntityRedisSearchIndexerNamespace(t *testing.T) {
func testEntityRedisSearchIndexer(t *testing.T, redisNamespace, version string) {
var entity *redisSearchEntity
registry := &Registry{}
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
engine, def := prepareTables(t, registry, 5, redisNamespace, version, entity, &redisNoSearchEntity{})
defer def()
indexer := NewBackgroundConsumer(engine)
Expand Down Expand Up @@ -130,7 +130,7 @@ func testEntityRedisSearchIndexer(t *testing.T, redisNamespace, version string)
func TestEntityRedisSearchIndexerNoFakeDelete(t *testing.T) {
var entity *redisSearchEntityNoSearchableFakeDelete
registry := &Registry{}
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
engine, def := prepareTables(t, registry, 5, "", "2.0", entity)
defer def()
indexer := NewBackgroundConsumer(engine)
Expand Down Expand Up @@ -179,7 +179,7 @@ func TestEntityRedisSearchNamespace(t *testing.T) {
func testEntityRedisSearch(t *testing.T, redisNamespace string) {
var entity *redisSearchEntity
registry := &Registry{}
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
engine, def := prepareTables(t, registry, 5, redisNamespace, "2.0", entity, &redisNoSearchEntity{}, &redisNoSearchEntity{})

alters := engine.GetRedisSearchIndexAlters()
Expand Down Expand Up @@ -256,7 +256,7 @@ func testEntityRedisSearch(t *testing.T, redisNamespace string) {

indices := engine.GetRedisSearch("search").ListIndices()
assert.Len(t, indices, 1)
assert.Equal(t, "beeorm.redisSearchEntity", indices[0])
assert.Equal(t, "trixorm.redisSearchEntity", indices[0])
info := engine.GetRedisSearch("search").Info(indices[0])
assert.False(t, info.Indexing)
assert.True(t, info.Options.NoFreqs)
Expand All @@ -267,7 +267,7 @@ func testEntityRedisSearch(t *testing.T, redisNamespace string) {
if redisNamespace != "" {
prefix = redisNamespace + ":"
}
assert.Equal(t, []string{prefix + "7499e:"}, info.Definition.Prefixes)
assert.Equal(t, []string{prefix + "554dd:"}, info.Definition.Prefixes)
assert.Len(t, info.Fields, 25)
assert.Equal(t, "ID", info.Fields[0].Name)
assert.Equal(t, "NUMERIC", info.Fields[0].Type)
Expand Down Expand Up @@ -1094,7 +1094,7 @@ func testEntityRedisSearch(t *testing.T, redisNamespace string) {
engine.RedisSearch(&[]*string{}, query, NewPager(1, 100))
})

assert.PanicsWithError(t, "entity beeorm.redisNoSearchEntity is not searchable", func() {
assert.PanicsWithError(t, "entity trixorm.redisNoSearchEntity is not searchable", func() {
query = &RedisSearchQuery{}
engine.RedisSearch(&[]*redisNoSearchEntity{}, query, NewPager(1, 100))
})
Expand Down
2 changes: 1 addition & 1 deletion event_broker.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion event_broker_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down
2 changes: 1 addition & 1 deletion flusher.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
24 changes: 12 additions & 12 deletions flusher_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand Down Expand Up @@ -51,7 +51,7 @@ type benchmarkIsDirtyEntity struct {
CreatedAt time.Time `orm:"time=true;index=index_created_at"`
LastActiveAt time.Time `orm:"time=true;index=index_last_active_at"`
Guild *flushEntity ``
GuildRank string `orm:"enum=beeorm.TestSet"`
GuildRank string `orm:"enum=trixorm.TestSet"`
Lang string `orm:"length=2"`
CountryCode string `orm:"length=8"`
Level uint8 `orm:"index=index_level"`
Expand Down Expand Up @@ -331,10 +331,10 @@ type flushEntity struct {
ReferenceManyRequired []*flushEntityReference `orm:"required"`
StringSlice []string
StringSliceNotNull []string `orm:"required"`
SetNullable []string `orm:"set=beeorm.TestSet"`
SetNotNull []string `orm:"set=beeorm.TestSet;required"`
EnumNullable string `orm:"enum=beeorm.TestEnum"`
EnumNotNull string `orm:"enum=beeorm.TestEnum;required"`
SetNullable []string `orm:"set=trixorm.TestSet"`
SetNotNull []string `orm:"set=trixorm.TestSet;required"`
EnumNullable string `orm:"enum=trixorm.TestEnum"`
EnumNotNull string `orm:"enum=trixorm.TestEnum;required"`
Ignored []string `orm:"ignore"`
Blob []uint8
Bool bool
Expand Down Expand Up @@ -400,8 +400,8 @@ func testFlush(t *testing.T, local bool, redis bool) {
var reference *flushEntityReference
registry := &Registry{}
registry.RegisterRedisStream("entity_changed", "default", []string{"test-group-1"})
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("beeorm.TestSet", TestSet)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestSet", TestSet)
engine, def := prepareTables(t, registry, 5, "", "2.0", entity, reference)
defer def()

Expand Down Expand Up @@ -524,7 +524,7 @@ func testFlush(t *testing.T, local bool, redis bool) {
assert.Nil(t, entity.FlushStructPtr)

entity.ReferenceOne.Name = "John 2"
assert.PanicsWithError(t, fmt.Sprintf("entity is not loaded and can't be updated: beeorm.flushEntityReference [%d]", refOneID), func() {
assert.PanicsWithError(t, fmt.Sprintf("entity is not loaded and can't be updated: trixorm.flushEntityReference [%d]", refOneID), func() {
engine.Flush(entity.ReferenceOne)
})

Expand Down Expand Up @@ -1113,8 +1113,8 @@ func BenchmarkFlusherUpdateNoCache(b *testing.B) {
func BenchmarkIsDirty(b *testing.B) {
var entity *benchmarkIsDirtyEntity
registry := &Registry{}
registry.RegisterEnum("beeorm.TestEnum", []string{"a", "b", "c"})
registry.RegisterEnum("beeorm.TestSet", []string{"a", "b", "c"})
registry.RegisterEnum("trixorm.TestEnum", []string{"a", "b", "c"})
registry.RegisterEnum("trixorm.TestSet", []string{"a", "b", "c"})
registry.RegisterRedisStream("entity_changed", "default", []string{"test-group-1"})
engine, def := prepareTables(nil, registry, 5, "", "2.0",
entity, &flushEntity{}, &flushEntityReference{})
Expand Down Expand Up @@ -1372,7 +1372,7 @@ func benchmarkFlusher(b *testing.B, useLocalCache, useRedisCache bool) {
var entity *flushEntityBenchmark
registry := &Registry{}
registry.RegisterRedisStream("entity_changed", "default", []string{"test-group-1"})
registry.RegisterEnum("beeorm.TestEnum", []string{"a", "b", "c"})
registry.RegisterEnum("trixorm.TestEnum", []string{"a", "b", "c"})
engine, def := prepareTables(nil, registry, 5, "", "2.0", entity)
defer def()

Expand Down
11 changes: 3 additions & 8 deletions global_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"context"
Expand All @@ -23,13 +23,8 @@ func (h *testLogHandler) clear() {
}

func prepareTables(t *testing.T, registry *Registry, mySQLVersion int, redisNamespace, redisSearchVersion string, entities ...Entity) (engine *Engine, def func()) {
if mySQLVersion == 5 {
registry.RegisterMySQLPool("root:root@tcp(localhost:3311)/test?limit_connections=10")
registry.RegisterMySQLPool("root:root@tcp(localhost:3311)/test_log", "log")
} else {
registry.RegisterMySQLPool("root:root@tcp(localhost:3312)/test")
registry.RegisterMySQLPool("root:root@tcp(localhost:3312)/test_log", "log")
}
registry.RegisterMySQLPool("root:root@tcp(localhost:3312)/test?limit_connections=10")
registry.RegisterMySQLPool("root:root@tcp(localhost:3312)/test_log", "log")
if redisSearchVersion == "2.0" {
registry.RegisterRedis("localhost:6382", redisNamespace, 15)
registry.RegisterRedis("localhost:6382", redisNamespace, 14, "default_queue")
Expand Down
2 changes: 1 addition & 1 deletion load_by_id.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions load_by_id_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"testing"
Expand Down Expand Up @@ -252,7 +252,7 @@ func testLoadByID(t *testing.T, local, redis bool) {
engine, def = prepareTables(t, &Registry{}, 5, "", "2.0")
defer def()
entity = &loadByIDEntity{}
assert.PanicsWithError(t, "entity 'beeorm.loadByIDEntity' is not registered", func() {
assert.PanicsWithError(t, "entity 'trixorm.loadByIDEntity' is not registered", func() {
engine.LoadByID(1, entity)
})
}
Expand All @@ -265,7 +265,7 @@ func BenchmarkLoadByIDdLocalCache(b *testing.B) {
func benchmarkLoadByIDLocalCache(b *testing.B, local, redis bool) {
entity := &loadByIDBenchmarkEntity{}
registry := &Registry{}
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
registry.RegisterLocalCache(10000)
engine, def := prepareTables(nil, registry, 5, "", "2.0", entity)
defer def()
Expand Down
2 changes: 1 addition & 1 deletion load_by_ids.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
6 changes: 3 additions & 3 deletions load_by_ids_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down Expand Up @@ -275,7 +275,7 @@ func testLoadByIds(t *testing.T, local, redis bool) {

engine, def = prepareTables(t, &Registry{}, 5, "", "2.0")
defer def()
assert.PanicsWithError(t, "entity 'beeorm.loadByIdsEntity' is not registered", func() {
assert.PanicsWithError(t, "entity 'trixorm.loadByIdsEntity' is not registered", func() {
engine.LoadByIDs([]uint64{1}, &rows)
})
}
Expand All @@ -289,7 +289,7 @@ func benchmarkLoadByIDsLocalCache(b *testing.B) {
entity := &schemaEntity{}
ref := &schemaEntityRef{}
registry := &Registry{}
registry.RegisterEnumStruct("beeorm.TestEnum", TestEnum)
registry.RegisterEnumStruct("trixorm.TestEnum", TestEnum)
registry.RegisterLocalCache(10000)
engine, def := prepareTables(nil, registry, 5, "", "2.0", entity, ref)
defer def()
Expand Down
2 changes: 1 addition & 1 deletion local_cache.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package beeorm
package trixorm

import (
"fmt"
Expand Down
Loading