GithubHelp home page GithubHelp logo

objectbox / objectbox-go Goto Github PK

View Code? Open in Web Editor NEW
1.0K 22.0 45.0 2.4 MB

Embedded Go Database, the fast alternative to SQLite, gorm, etc.

Home Page: https://objectbox.io

License: Apache License 2.0

Shell 1.22% Go 67.05% PowerShell 0.68% C 31.05%
database iot go golang embedded edge nosql offline-first storage

objectbox-go's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

objectbox-go's Issues

Multiple struct tags not working

It's not mentioned in the docs if unique cause an index to be generated so I added to the tagged literal but this doesn't seem to be support at this time.

type Foo struct {
	ID   uint64 `objectbox:"id"`
	Name string `objectbox:"index,unique"`
}

Generation give can't prepare bindings for feeds.go: unknown annotation index,unique on property Name found in Foo

TestQueries fail and output lots of logs like [WARN ] Skipped low-level close of cursor (write, TX #x alive)

OS: MacOS 10.12.6
Go: 1.11.2 amd64
libobjectbox: 0.4
objectbox-go: v0.8.0

go test -run=TestQueries

--- FAIL: TestQueries (0.11s)
    query_test.go:225: Executing 128 test cases
    assert.go:73: case #27 expected {Int64 in [94|47]}, but got {Int64 in [47|94]}
         Call stack:
        query_test.go:241

FAIL
exit status 1
FAIL	github.com/objectbox/objectbox-go/test	0.123s

go test -run='TestConcurrentPut$'

[WARN ] Skipped low-level close of cursor (write, TX #4 alive)
[WARN ] Skipped low-level close of cursor (write, TX #4 alive)
[WARN ] Skipped low-level close of cursor (write, TX #5 alive)
[WARN ] Skipped low-level close of cursor (write, TX #13 alive)
[WARN ] Skipped low-level close of cursor (write, TX #9 alive)
[WARN ] Skipped low-level close of cursor (write, TX #14 alive)
...
[WARN ] Skipped low-level close of cursor (write, TX #103 alive)
[WARN ] Skipped low-level close of cursor (write, TX #104 alive)
PASS
ok  	github.com/objectbox/objectbox-go/test	0.038s

dyld Symbol not found: _obx_async on latest xcode, macos, and golang

I updated to latest Mac version and XCode. After install when I build and run the example it am getting:
dyld[17149]: Symbol not found: _obx_async
Referenced from: <7BEAD442-460A-303C-B58C-445863176369>
Expected in: unknown

Basic info
Mac Ventura 13.6 / XCode 15.0 / Golang 1.21 / ObjectBox 1.7

How to reproduce

I am just following the install and example in Github. I am also running the test.sh.

Encryption & static linking

Hello,

I really like ObjectBox, and I would love to add it to my stack and build software around it, however the lack of encryption support in the Go incarnation makes it a no go (pun intended). Are there any plans to add encryption to the Go incarnation of ObjectBox?

Also, I need to static link the lib, however no static build is being offered currently. What do I need to do to achieve this?

Can not generate struct with relation

When generating the following struct

type Progress struct {
	Id             uint64
	Show           *shows.Show `objectbox:"link"`
}

which has a relation to the show struct, i manage the get the following error:

Generating ObjectBox bindings for internal/<pgk>/object.go
can't prepare bindings for internal/<pgk>/object.go: error running type-check: internal/<pgk>/object.go:7:2: could not import og/internal/showsrss (type-checking package "og/internal/showsrss" failed (/Users/ogkevin/projects/OGKevin/og/internal/showsrss/entires_api.go:8:2: could not import github.com/objectbox/objectbox-go/objectbox (type-checking package "github.com/objectbox/objectbox-go/objectbox" failed (/Users/ogkevin/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/model.go:30:2: could not import github.com/objectbox/objectbox-go/internal/generator (go/build: importGo github.com/objectbox/objectbox-go/internal/generator: exit status 1
go: finding github.com/objectbox/objectbox-go/internal/generator latest
go: finding github.com/objectbox/objectbox-go/internal latest
can't load package: package github.com/objectbox/objectbox-go/internal/generator: unknown import path "github.com/objectbox/objectbox-go/internal/generator": cannot find module providing package github.com/objectbox/objectbox-go/internal/generator

it leads me to believe that there is something wrong with the object box package? I tried diging into the code but its a little cryptic and could not follow the logic of typing checking.

If i remove the link between the 2, the generator is able to generate without problems. Any ideas ?

Scalability

Hi all,

I know this is targeted for embedded systems, but I like the idea of object storage. It makes my life easier. That being said, what kind of performance hits will I experience as the database scales (say, to 350GB+)?

Thanks!

Cgo compile error with gcc on Windows 10 Pro: " undefined reference to `obx_txn_mark_success"

Hi

Trying to run the Task demo code from the getting started docs but compile is failing with the following error:

GOROOT=C:\Program Files\Go #gosetup
GOPATH=C:\Users\user\go #gosetup
"C:\Program Files\Go\bin\go.exe" build -o C:\Users\user\AppData\Local\Temp\GoLand\___go_build_scratch1_go.exe "D:\Google Drive\Golang\AlphaEngine\ae\scratch\scratch1\scratch1.go" #gosetup
# github.com/objectbox/objectbox-go/objectbox
c:/users/user/appdata/local/programs/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/11.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: $WORK\b002\_x012.o: in function `_cgo_1d5082261c69_Cfunc_obx_txn_mark_success':
/tmp/go-build/cgo-gcc-prolog:134: undefined reference to `obx_txn_mark_success'
collect2.exe: error: ld returned 1 exit status

Compilation finished with exit code 2

I'm not a low-level developer so please forgive if I'm making a newbie error.

Please advise!

WASM

Am trying to get running as WASM, but its quite difficult to get golang and wasm to both compile to WASM.

Any ideas ?

go get install instructions don't work

following instructions in the README:

go get github.com/objectbox/objectbox-go
can't load package: package github.com/objectbox/objectbox-go: no Go files ...

Time property in inlined struct

Code generator has problems with binding Time properties of inlined struct.
Consider following structs:

type Metadata struct {
	Id       uint64
	Created  time.Time `objectbox:"date"`
	Modified time.Time `objectbox:"date"`
}

type BlogPost struct {
	Metadata `objectbox:"inline"`
	Title    string
	Content  string
}

Generated entity definition does not contain Created and Modified properties:

var BlogPostBinding = blogPost_EntityInfo{
	Entity: objectbox.Entity{
		Id: 6,
	},
	Uid: 5152285828382661602,
}

// BlogPost_ contains type-based Property helpers to facilitate some common operations such as Queries.
var BlogPost_ = struct {
	Id      *objectbox.PropertyUint64
	Title   *objectbox.PropertyString
	Content *objectbox.PropertyString
}{
	Id: &objectbox.PropertyUint64{
		BaseProperty: &objectbox.BaseProperty{
			Id:     1,
			Entity: &BlogPostBinding.Entity,
		},
	},
	Title: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     2,
			Entity: &BlogPostBinding.Entity,
		},
	},
	Content: &objectbox.PropertyString{
		BaseProperty: &objectbox.BaseProperty{
			Id:     3,
			Entity: &BlogPostBinding.Entity,
		},
	},
}

Additionally Load function looks like this (notice Created and Modified properties):

func (blogPost_EntityInfo) Load(ob *objectbox.ObjectBox, bytes []byte) (interface{}, error) {
	if len(bytes) == 0 { // sanity check, should "never" happen
		return nil, errors.New("can't deserialize an object of type 'BlogPost' - no data received")
	}

	var table = &flatbuffers.Table{
		Bytes: bytes,
		Pos:   flatbuffers.GetUOffsetT(bytes),
	}

	var propId = table.GetUint64Slot(4, 0)

	return &BlogPost{
		Metadata: Metadata{
			Id:       propId,
			Created:  Time{},
			Modified: Time{},
		},
		Title:   fbutils.GetStringSlot(table, 6),
		Content: fbutils.GetStringSlot(table, 8),
	}, nil
}

Expected behaviour: Inlined struct time properties are properly bound (just like regular properties)

Objectbox version: 1.7.0
Objectbox generator version: 0.13.0

Self-assigned IDs

ID is higher or equal to internal ID sequence: 3462622074874930866 (vs. 1). Use ID 0 (zero) to insert new entities.

Repo is down - 502 Bad Gateway error

Running ObjectBoxInstallScript.ps1 on Windows 10 Pro is failing.

Attempting to access https://dl.bintray.com/objectbox/conan/objectbox/objectbox-c returns a 502 Bad Gateway error.

Looks like a great project and I'm keen to get ObjectBox up and running for an urgent evaluation. Please advise on how I can get my hands on the .dll as I can't spot it on the open web.

While I'm in contact, my requirement is to select a subset of objects sorted by integer key from a set of some millions in a flat table.

It's not clear from a quick scan of the docs how ObjectBox handles sorting internally.

SQLite has a sorted index, and I'm getting reasonable results.

To be sure it's worth the effort of setting up a test, is there a reasonable chance that ObjectBox would give me equal or better performance on these large sorted selects? The insertions will not be made in index sequence.

All being equal, I'd prefer ObjectBox to SQLite because of the faster ingestion provided the select queries would at least match the SQLite performance.

Downloading C-API v0.13.0 into download\objectbox-0.13.0.tgz
C:\Users\user\Downloads\ObjectBoxInstallScript.ps1 : System.Management.Automation.MethodInvocationException: Exception
calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (502) Bad Gateway." --->
System.Net.WebException: The remote server returned an error: (502) Bad Gateway.
   at System.Net.WebClient.DownloadFile(Uri address, String fileName)
   at CallSite.Target(Closure , CallSite , Object , Object , Object )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception
exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
At line:1 char:91
+ ... cess Bypass }; & 'C:\Users\user\Downloads\ObjectBoxInstallScript.ps1'
+                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,ObjectBoxInstallScript.ps1

How do I disable DEBUG messages.

Everytime i open a connection, a bunch of debug messages spits out wich is nice for dev env, but for prod i rather not have them.

e.g.

001-18:57:34.0229 [DEBUG] Current directory when opening store: <dir>
001-18:57:34.0230 [DEBUG] ObjectBox 2.4.0-2019-06-26 (64 bit mode)
001-18:57:34.0230 [DEBUG] Opening DB "/tmp/obj" (max 1048576 KB, mode 755)...
001-18:57:34.0310 [DEBUG] Opened database /tmp/obj
001-18:57:34.0322 [DEBUG] Synching schema with 1 existing and 1 new entities
001-18:57:34.0323 [DEBUG] TX #1 committed
001-18:57:34.0323 [DEBUG] Closing database
001-18:57:34.0324 [DEBUG] Current directory when opening store: <dir>

001-18:57:34.0324 [DEBUG] Opening DB "/tmp/obj" (max 1048576 KB, mode 755)...
001-18:57:34.0334 [DEBUG] Opened database /tmp/obj
001-18:57:34.0335 [DEBUG] Read 1 entity type(s)
001-18:57:34.0335 [DEBUG] Store set up in 11 ms

How can i disable this ?

The corresponding go code:

objectBox, err := objectbox.NewBuilder().
		Directory(dir).
		Model(SomeModel.ObjectBoxModel()).
		Build()

Thanks in advance.

Installation fails under WSL2

Description

Installation fails

Basic info

Please complete the following information:

  • ObjectBox version: latest
  • Device: Desktop PC Intel CPU
  • OS: Ubuntu 20.04 running under WSL2

How to reproduce

Run installation script

Expected behavior

Objectbox installed

Code

bash <(curl -s https://raw.githubusercontent.com/objectbox/objectbox-go/main/install.sh) --sync

Logs, stack traces

Base config: OS Linux and architecture x86_64
Using configuration sync-linux-x64
Resolved URL: https://github.com/objectbox/objectbox-c/releases/download/v0.15.0/objectbox-sync-linux-x64.tar.gz
Downloading ObjectBox library version v0.15.0 for sync-linux-x64...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   670  100   670    0     0   1013      0 --:--:-- --:--:-- --:--:--  1013
100 1455k  100 1455k    0     0   586k      0  0:00:02  0:00:02 --:--:--  823k
Downloaded:
1.5M    download/objectbox-0.15.0-sync-linux-x64.tar.gz

Extracting into download/objectbox-0.15.0-sync-linux-x64...
Copied to /home/mario/go/src/github.com/objectbox/objectbox-go/objectboxlib/lib:
total 3448
-rwxr-xr-x 1 mario mario 3530328 Jan  9 13:26 libobjectbox.so
OK. Do you want to install the library into /usr/lib? [Y/n] y
Installing /usr/lib/libobjectbox.so
Installed objectbox libraries:
        libobjectbox.so (libc6,x86-64) => /usr/lib/libobjectbox.so
/home/mario/go/src/github.com/objectbox/objectbox-go
Your project doesn't seem to be using go modules. Installing FlatBuffers & ObjectBox using go get.
y
# github.com/objectbox/objectbox-go/objectbox
/usr/bin/ld: $WORK/b001/_x012.o: in function `_cgo_1d5082261c69_Cfunc_obx_txn_mark_success':
/tmp/go-build/cgo-gcc-prolog:134: undefined reference to `obx_txn_mark_success'
collect2: error: ld returned 1 exit status

Support cross compilation

Investigate whether/how we can support cross-compilation, e.g. compiling for Linux on macOS.
Please upvote this issue if you find it important.

Objectbox is "hanging dead" when trying to delete "parent" table (relation one-to-many)

type Medium struct {
	Id         uint64
	Collection *Collection `objectbox:"link"`
}

type Collection struct {
	Id          uint64
}

If in both boxes data present, calling

collectionBox := model.BoxForCollection(ob)
collectionBox.RemoveAll()

before

mediumBox := model.BoxForMedium(ob)
mediumBox.RemoveAll()

and Objectbox just does something unknown indefinitely until interrupted. No errors, nothing.

What is the best way of dealing with multiple models.

I was thinking of passing 1 object box instance down as dependency to methods. But i soon reliased that you need to create 1 objectbox per model. e.g. the following will not work:

	ob, err := objectbox.NewBuilder().
		Directory(dir).
		Model(package1.ObjectBoxModel()).
		Model(package2.ObjectBoxModel()).
		Build()
box1 := BoxForModel1(ob)
box2 := BoxForModel2(ob)

And this is because of

	builder.Error = model.validate()
	if builder.Error != nil {
		builder.model = nil
	} else {
		builder.model = model // this line
	}

So as i understand, i need to create 1 objectbox + 1 BxoForMODEL with one ObjectBox per model. Whith this being said, what is the recomanded way to deal with mutliple models? Instead of passing down from top of the stack just create these 2 instances every single time i need it ? I rather have 1 thing to pass down that has everything e.g. the sql driver (objecbox) which you create repositories (BoxForMODEL) with. 🤔

Also is it an idea to return an error when you try to regiester more then 1 model? Causes less confusion later when you get errors like

Could not create query - please check your query conditions: unordered_map::at: key not found

Following GETTING STARTED guide does not work

🚨 First, please check:

Description

When I add the code from the getting started guide into a main.go file and run "go run main.go", I receive the following error:
package command-line-arguments main.go:5:2: use of internal package github.com/objectbox/objectbox-go/examples/tasks/internal/model not allowed

Basic info

Please complete the following information:

  • ObjectBox version (are you using the latest version?): [e.g. v1.1.2]
    not sure how to tell,, I ran the install script, it is the version installed from there

  • GO version:
    go version go1.15.3 darwin/amd64

  • Reproducibility: [e.g. occurred once only | occasionally without visible pattern | always]
    always

  • Device: [e.g. Desktop]
    Desktop

  • OS: [e.g. Ubuntu 20.04]
    MacOS

How to reproduce

Steps to reproduce the behavior:

  1. Enter code from user guide in files specified
  2. Run go generate
  3. Run go run
  4. Receive eror

Expected behavior

This should run the sample program documented

Code

`package main

import (
"fmt"
"github.com/objectbox/objectbox-go/examples/tasks/internal/model"
"github.com/objectbox/objectbox-go/objectbox"
)

func initObjectBox() *objectbox.ObjectBox {
objectBox, _ := objectbox.NewBuilder().Model(model.ObjectBoxModel()).Build()
return objectBox
}

func main() {
// load objectbox
ob := initObjectBox()
defer ob.Close() // In a server app, you would just keep ob and close on shutdown

box := model.BoxForTask(ob)

// Create
id, _ := box.Put(&model.Task{
Text: "Buy milk",
})

task, _ := box.Get(id) // Read
task.Text += " & some bread"

fmt.Printf("My Test Record:\n")
fmt.Printf("%+v", task)
fmt.Printf("\n\n")

box.Put(task) // Update
count, _ := box.Count()
fmt.Printf("After the add, there are %d tasks in the list\n", count)

box.Remove(task) // Delete
count, _ = box.Count()
fmt.Printf("After the remove, there are %d tasks in the list\n", count)
}`

Installation issue: undefined: QueryBuilder

While following the installation steps: dependencies, an error occurs with this command:

go get -u github.com/objectbox/objectbox-go/...
github.com/objectbox/objectbox-go/objectbox
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:21:14: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:27:20: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:30:48: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/condition.go:40:52: undefined: QueryBuilder
../../../github.com/objectbox/objectbox-go/objectbox/entity.go:21:5: undefined: TypeId

============
go version go1.13.3 linux/amd64

I can see that the QueryBuilder type is defined in: ../../../github.com/objectbox/objectbox-go/objectbox/querybuilder.go, however the file is not being included while building.

Thanks

Support "Flex" type

C-API v0.15 brought the support of a flexible field type to ObjectBox. This issue is to track interest in bringing the feature to Go.

Upgrade dependency "github.com/google/flatbuffers"

Background

Repo github.com/objectbox/objectbox-go depends on github.com/google/[email protected].

https://github.com/objectbox/objectbox-go/blob/main/go.mod#L6

However, comparing version v1.12.0 of github.com/google/flatbuffers from proxy.golang.org and github, there are inconsistencies.

commit time of the copy on github.com

"committer": {
      "name": "Wouter van Oortmerssen",
      "email": "[email protected]",
      "date": "2020-03-12T22:33:39Z"
    }

commit time of the copy on proxy.golang.org

{"Version":"v1.12.0","Time":"2020-03-12T21:45:27Z"}

So the checksum from the code in github does not match the checksum saved in sum.golang.org. The v1.12.0 tag of github.com/google/flatbuffers might have been retagged after a minor edition on github. I guess you use proxy.golang.org to get dependencies, but that also shows that your project is depending on the copy of github.com/google/[email protected] before its edition. Depending upon such inconsistent tag version may also result in some unexpected errors as well as build errors due to different proxy settings.

For example, when someone who does not use proxy.golang.org, say GOPROXY=direct, attempts to get github.com/google/[email protected], the following error occurs.

go: downloading github.com/google/flatbuffers v1.12.0
go: github.com/google/flatbuffers@v1.12.0: verifying module: checksum mismatch
        downloaded: h1:N8EguYFm2wwdpoNcpchQY0tPs85vOJkboFb2dPxmixo=
        sum.golang.org: h1:/PtAHvnBY4Kqnx/xCQ3OIV9uYcSFGScBsWI3Oogeh6w=

SECURITY ERROR
This download does NOT match the one reported by the checksum server.
The bits may have been replaced on the origin server, or an attacker may
have intercepted the download attempt.

For more information, see 'go help module-auth'.

So, this is a reminder in the hope that you can get rid of this problematic version of project github.com/google/flatbuffers.

Solution

1. Bump the version of dependency github.com/google/flatbuffers

I would recommend bumping the version of github.com/google/flatbuffers to a new release to ensure dependency copy in proxy.golang.org and github in sync.

References

How to statically compile in golang so library is included?

Description

When deploying the binary, it also expects the library (.so file) available at system level

I tried keeping this file next to the binary but it did not work

Is there a way to statically compile in golang so one binary has all its dependencies?

What I tried

go build -ldflags="-extldflags=-static"

Error I got

/usr/local/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lobjectbox: No such file or directory
/usr/bin/ld: /tmp/go-link-2309517836/000004.o: in function `_cgo_cbcce81e6342_C2func_getaddrinfo':
/tmp/go-build/cgo-gcc-prolog:58: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
collect2: error: ld returned 1 exit status

Support sync-server

Support embedded sync-server as provided by the c-api in objectbox-sync.h

Version.LessThan() function not working properly

Description

When using v0.19.0 of the Go library with v0.19.0 of the C library, I get the following warning message:

Note: the loaded ObjectBox C library should be updated.
      Found ObjectBox version 0.19.0, but the minimum recommended version is 0.18.1.

Basic info

Please complete the following information:

  • ObjectBox version (are you using the latest version?): v0.19.0 (Go and C libraries)
  • Reproducibility: always
  • Device: desktop
  • OS: Debian

How to reproduce

Simply build a small demo program similar to the getting started example and compile it and you should get the warning.

Expected behavior

No warning(s) should be emitted as the "C" library is greater than/equal to the Go library version.

Code

Check the LessThan() function in version.go on line 35. It appears to me that this may be causing the issue. You may also want to just use the golang.org/x/mod/semver package to simplify your version comparison and management.

Query.Find() can't handle large slice attributes

I'm currently facing an odd behaviour of queries on, and that's probably important, the raspberry pi.

Normal behaviour of a query with a condition like Record_.Patient.Equals(patient.Id), where Patient is another entity and linked via one (Patient) to many (Record) and patient.Id is the ObjectBox id, to return a slice of all records that match the condition. Records also has an attribute Points which is the "ObjectBox native type" []string.

So the problem now is, that if the Points attribute contains more than roughly 500 strings Find() returns an empty slice. Though Count() and other methods still work perfectly fine.

My current workaround is to use FindIds() and get the Points via GetMany()

Maybe fix this ?

install.ps1 attempts a download from non existing path.

Creating download directory download
Downloading C-API v0.13.0 into download\objectbox-0.13.0.tgz

System.Management.Automation.MethodInvocationException: Exception calling "DownloadFile" with "2" argument(s): "An
exception occurred during a WebClient request." ---> System.Net.WebException: An exception occurred during a WebClient
request. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path
'C:\WINDOWS\system32\download\objectbox-0.13.0.tgz'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights,
FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at System.Net.WebClient.DownloadFile(Uri address, String fileName)
   --- End of inner exception stack trace ---
   at System.Net.WebClient.DownloadFile(Uri address, String fileName)
   at CallSite.Target(Closure , CallSite , Object , Object , Object )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception
exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
At line:1 char:1
+ .\install.ps1
+ ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,install.ps1

Press any key to exit:

Multi-threaded access to a box

Hello,

Can you help me understand how to avoid a segmentation violation when two threads are accessing the same box?

Here is the output from running the attached sample project:

bob@TRADE-SERVER:~/DEV/testObjectBox$ ./testObjectBox
People count: 0
[Thread] counter: 0, people: 0
[Thread] counter: 0, people: 0
[Thread] counter: 1000, people: 1940
[Thread] counter: 1000, people: 2064
People count: 2535
[Thread] counter: 2000, people: 3918
[Thread] counter: 2000, people: 4081
People count: 4813
[Thread] counter: 3000, people: 5916
[Thread] counter: 3000, people: 6079
People count: 6904
fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x2 addr=0x7f9730005f88 pc=0x7f9730005f88]

runtime stack:
runtime.throw(0x68c601, 0x2a)
/usr/local/go/src/runtime/panic.go:774 +0x72
runtime.sigpanic()
/usr/local/go/src/runtime/signal_unix.go:378 +0x47c

goroutine 35 [syscall, locked to thread]:
runtime.cgocall(0x5f6b90, 0xc000061c08, 0xc000024000)
/usr/local/go/src/runtime/cgocall.go:128 +0x5b fp=0xc000061bd8 sp=0xc000061ba0 pc=0x408c2b
github.com/objectbox/objectbox-go/objectbox._Cfunc_obx_query_find(0x7f96c8001c00, 0x0, 0x0, 0x0)
_cgo_gotypes.go:1649 +0x4e fp=0xc000061c08 sp=0xc000061bd8 pc=0x5d5efe
github.com/objectbox/objectbox-go/objectbox.(*Query).Find.func1.1(0xc0004cbae0, 0xc000061c98)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/query.go:90 +0x89 fp=0xc000061c58 sp=0xc000061c08 pc=0x5ea079
github.com/objectbox/objectbox-go/objectbox.(*Query).Find.func1(0x300000002)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/query.go:90 +0x2a fp=0xc000061c78 sp=0xc000061c58 pc=0x5ea0ca
github.com/objectbox/objectbox-go/objectbox.cGetBytesArray(0xc000061e80, 0xc000061d30, 0xc000000000, 0x409295, 0xc000056700, 0xc000061d20)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/c-tools.go:71 +0x30 fp=0xc000061cc8 sp=0xc000061c78 pc=0x5dc650
github.com/objectbox/objectbox-go/objectbox.(*Box).readManyObjects.func1(0xc000061d80, 0x7f9728007f90)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/box.go:552 +0x5c fp=0xc000061d70 sp=0xc000061cc8 pc=0x5e75cc
github.com/objectbox/objectbox-go/objectbox.(*ObjectBox).runInTxn(0xc00019b6b0, 0xa76401, 0xc000061e00, 0x0, 0x0)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/objectbox.go:148 +0xa1 fp=0xc000061dd8 sp=0xc000061d70 pc=0x5de061
github.com/objectbox/objectbox-go/objectbox.(*ObjectBox).RunInReadTx(...)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/objectbox.go:105
github.com/objectbox/objectbox-go/objectbox.(*Box).readManyObjects(0xc00016c940, 0x1, 0xc000061e80, 0x0, 0x0, 0x0, 0xc000061e90)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/box.go:551 +0x8a fp=0xc000061e38 sp=0xc000061dd8 pc=0x5da1ba
github.com/objectbox/objectbox-go/objectbox.(*Query).Find(0xc0004cbae0, 0xc000012170, 0x1, 0x1, 0xc0004cbae0)
/home/bob/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/query.go:92 +0x6f fp=0xc000061ea0 sp=0xc000061e38 pc=0x5de8ff
testObjectBox/person.(*PersonQuery).Find(...)
/home/bob/DEV/testObjectBox/person/person.obx.go:359
main.read(0xc0001701c8, 0xc0001701c8, 0x1cdb, 0x1cdb, 0x0, 0x0)
/home/bob/DEV/testObjectBox/main.go:80 +0xf1 fp=0xc000061f20 sp=0xc000061ea0 pc=0x5f5961
main.loop(0xc00019b6b0, 0xc0001701c8, 0xf4240)
/home/bob/DEV/testObjectBox/main.go:50 +0xbf fp=0xc000061fc8 sp=0xc000061f20 pc=0x5f554f
runtime.goexit()
/usr/local/go/src/runtime/asm_amd64.s:1357 +0x1 fp=0xc000061fd0 sp=0xc000061fc8 pc=0x45eb61
created by main.main
/home/bob/DEV/testObjectBox/main.go:23 +0xf7

goroutine 1 [sleep]:
runtime.goparkunlock(...)
/usr/local/go/src/runtime/proc.go:310
time.Sleep(0x4a817c800)
/usr/local/go/src/runtime/time.go:105 +0x157
main.main()
/home/bob/DEV/testObjectBox/main.go:33 +0x18f

goroutine 34 [semacquire]:
sync.runtime_SemacquireMutex(0xa86c94, 0xc000065e00, 0x1)
/usr/local/go/src/runtime/sema.go:71 +0x47
sync.(*Mutex).lockSlow(0xa86c90)
/usr/local/go/src/sync/mutex.go:138 +0xfc
sync.(*Mutex).Lock(...)
/usr/local/go/src/sync/mutex.go:81
sync.(*RWMutex).Lock(0xa86c90)
/usr/local/go/src/sync/rwmutex.go:98 +0x97
main.read(0xc0001701c8, 0xc0001701c8, 0x1cdb, 0x1cdb, 0x0, 0x0)
/home/bob/DEV/testObjectBox/main.go:79 +0xe3
main.loop(0xc00019b6b0, 0xc0001701c8, 0xf4240)
/home/bob/DEV/testObjectBox/main.go:50 +0xbf
created by main.main
/home/bob/DEV/testObjectBox/main.go:22 +0xc2
testObjectBox.zip

go generate fails due to missing entity

Reproducer here:
https://github.com/jpeeler/objectbox-test

I don't understand the failure as Credential is present in the same file as Institution, which is clearly found.

Copied output from commit:

$ go generate
Generating ObjectBox bindings for main.go
2020/04/04 21:58:49 Notice: skipping unavailable (private) property wall found in MyInstitution.Institution.InstitutionStatus.ItemLogins.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property ext found in MyInstitution.Institution.InstitutionStatus.ItemLogins.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property loc found in MyInstitution.Institution.InstitutionStatus.ItemLogins.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property wall found in MyInstitution.Institution.InstitutionStatus.TransactionsUpdates.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property ext found in MyInstitution.Institution.InstitutionStatus.TransactionsUpdates.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property loc found in MyInstitution.Institution.InstitutionStatus.TransactionsUpdates.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property wall found in MyInstitution.Institution.InstitutionStatus.Auth.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property ext found in MyInstitution.Institution.InstitutionStatus.Auth.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property loc found in MyInstitution.Institution.InstitutionStatus.Auth.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property wall found in MyInstitution.Institution.InstitutionStatus.Balance.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property ext found in MyInstitution.Institution.InstitutionStatus.Balance.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property loc found in MyInstitution.Institution.InstitutionStatus.Balance.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property wall found in MyInstitution.Institution.InstitutionStatus.Identity.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property ext found in MyInstitution.Institution.InstitutionStatus.Identity.LastStatusChange
2020/04/04 21:58:49 Notice: skipping unavailable (private) property loc found in MyInstitution.Institution.InstitutionStatus.Identity.LastStatusChange
can't merge binding model information: entity named 'Credential' was not found
exit status 2
main.go:8: running "go": exit status 1```

Database access.

Hello,

I am making an embedded system on Raspberry Pi 3 where I'm keeping track of arrivals of employees to work. I have two databases, one to store data about arrivals (RFID, time of arrival, etc.) and other to store general data about employees. Additionally, I also want to send data to cloud. For that purpose I have made two Golang programs, let's call them program1 for managing database of arrivals and program2 for database of employees. Is it possible to make these programs access both databases and make changes. If yes, how and in which situations?

Fresh install fails to run tests

ObjectBox looks like it might be a good choice for a personal project, but I'm having some issues getting it to work out of the, er.. box. The install script works fine, but running the go tests throws me a panic, and it looks as if some expected test data is missing.

go 1.13.4
macOS Mojave (10.14.x)

I'm using go modules and ran the install script from my project path - it updated go.mod as I expected:

	github.com/objectbox/objectbox-go v1.1.0 // indirect

Test output:

$ go test github.com/objectbox/objectbox-go/...
?       github.com/objectbox/objectbox-go/cmd/objectbox-gogen   [no test files]
?       github.com/objectbox/objectbox-go/examples/tasks        [no test files]
?       github.com/objectbox/objectbox-go/examples/tasks/internal/model [no test files]
?       github.com/objectbox/objectbox-go/internal/generator    [no test files]
?       github.com/objectbox/objectbox-go/internal/generator/modelinfo  [no test files]
?       github.com/objectbox/objectbox-go/internal/generator/templates  [no test files]
?       github.com/objectbox/objectbox-go/objectbox     [no test files]
ok      github.com/objectbox/objectbox-go/objectbox/fbutils     (cached)
001-14:48:42.5678 [ERROR] Storage error code 13
--- FAIL: TestBoxAsync (0.00s)
panic: Could not create ObjectBox - please check configuration: Dir does not exist: testdata (13) [recovered]
        panic: Could not create ObjectBox - please check configuration: Dir does not exist: testdata (13)

goroutine 35 [running]:
testing.tRunner.func1(0xc000130900)
        /usr/local/go/src/testing/testing.go:874 +0x3a3
panic(0x42f7d00, 0xc0001af2b0)
        /usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/objectbox/objectbox-go/objectbox.(*Builder).Build(0xc0001c0640, 0xc0001a8150, 0xc0001c0640, 0x24)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/builder.go:133 +0xdc
github.com/objectbox/objectbox-go/test/model.NewTestEnv(0xc000130900, 0xd0)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/test/model/testenv.go:54 +0xf8
github.com/objectbox/objectbox-go/test_test.testAsync(0xc000130900, 0x4392270)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/test/async_test.go:57 +0x43
github.com/objectbox/objectbox-go/test_test.TestBoxAsync(0xc000130900)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/test/async_test.go:29 +0x37
testing.tRunner(0xc000130900, 0x4392278)
        /usr/local/go/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:960 +0x350
FAIL    github.com/objectbox/objectbox-go/test  0.022s
?       github.com/objectbox/objectbox-go/test/assert   [no test files]
?       github.com/objectbox/objectbox-go/test/build    [no test files]
--- FAIL: TestGenerator (0.00s)
    --- FAIL: TestGenerator/relations (0.00s)
        test-all.go:67: Testing relations without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/relations/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/converters (0.00s)
        test-all.go:67: Testing converters without model info JSON
        test-all.go:177:   runeid.go
        assert.go:142: Unexpected error occurred: can't init ModelInfo: open testdata/converters/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:193
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/task (0.00s)
        test-all.go:67: Testing task without model info JSON
        test-all.go:177:   bypointer.go
        assert.go:142: Unexpected error occurred: can't init ModelInfo: open testdata/task/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:193
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/rename-property (0.00s)
        test-all.go:67: Testing rename-property without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/rename-property/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/remove-property (0.00s)
        test-all.go:67: Testing remove-property without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/remove-property/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/remove-index (0.00s)
        test-all.go:67: Testing remove-index without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/remove-index/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/property-update (0.00s)
        test-all.go:67: Testing property-update without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/property-update/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/typeful (0.00s)
        test-all.go:67: Testing typeful without model info JSON
        test-all.go:177:   aliases.go
        assert.go:142: Unexpected error occurred: can't init ModelInfo: open testdata/typeful/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:193
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/rename-relation (0.00s)
        test-all.go:67: Testing rename-relation without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/rename-relation/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/rename-entity (0.00s)
        test-all.go:67: Testing rename-entity without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/rename-entity/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/intra-package-dependency (0.00s)
        test-all.go:67: Testing intra-package-dependency without model info JSON
        assert.go:142: Unexpected error occurred: open testdata/intra-package-dependency/A.obx.go: permission denied 
             Call stack:
            test-all.go:79
            test-all.go:52
            
    --- FAIL: TestGenerator/cycles (0.00s)
        test-all.go:67: Testing cycles without model info JSON
        test-all.go:177:   embedding-named.fail.go
        assert.go:142: Values are not equal
            Expected: can't prepare bindings for testdata/cycles/embedding-named.fail.go: embedded struct cycle detected: EmbeddingNamedChainA.BPtr.CPtr on property APtr found in EmbeddingNamedChainA.BPtr.CPtr
            Received: can't init ModelInfo: open testdata/cycles/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:188
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/id (0.00s)
        test-all.go:67: Testing id without model info JSON
        test-all.go:177:   A.go
        assert.go:142: Unexpected error occurred: can't init ModelInfo: open testdata/id/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:193
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/negative (0.00s)
        test-all.go:67: Testing negative without model info JSON
        test-all.go:177:   duplicate-property.fail.go
        assert.go:142: Values are not equal
            Expected: can't prepare bindings for testdata/negative/duplicate-property.fail.go: duplicate name (note that property names are case insensitive) on property text found in DuplicateProperty
            Received: can't init ModelInfo: open testdata/negative/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:188
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/embedding (0.00s)
        test-all.go:67: Testing embedding without model info JSON
        test-all.go:177:   1.fail.go
        assert.go:142: Values are not equal
            Expected: can't prepare bindings for testdata/embedding/1.fail.go: duplicate name (note that property names are case insensitive) on property Value found in Negative1.BytesValue
            Received: can't init ModelInfo: open testdata/embedding/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:188
            test-all.go:82
            test-all.go:52
            
    --- FAIL: TestGenerator/multi-files (0.00s)
        test-all.go:67: Testing multi-files without model info JSON
        test-all.go:177:   A.go
        assert.go:142: Unexpected error occurred: can't init ModelInfo: open testdata/multi-files/objectbox-model.json: permission denied 
             Call stack:
            test-all.go:193
            test-all.go:82
            test-all.go:52
            
FAIL
FAIL    github.com/objectbox/objectbox-go/test/generator        0.027s
?       github.com/objectbox/objectbox-go/test/model    [no test files]
?       github.com/objectbox/objectbox-go/test/model/iot        [no test files]
2020/02/10 09:48:42 running the test with 100000 objects
001-14:48:42.5023 [ERROR] Storage error code 13
--- FAIL: TestPerformanceSimple (0.00s)
panic: Could not create ObjectBox - please check configuration: Dir does not exist: db (13) [recovered]
        panic: Could not create ObjectBox - please check configuration: Dir does not exist: db (13)

goroutine 36 [running]:
testing.tRunner.func1(0xc00012a800)
        /usr/local/go/src/testing/testing.go:874 +0x3a3
panic(0x424eee0, 0xc0001d40c0)
        /usr/local/go/src/runtime/panic.go:679 +0x1b2
github.com/objectbox/objectbox-go/objectbox.(*Builder).Build(0xc000185880, 0xc0001f0000, 0xc000185880, 0xc0000ca000)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/builder.go:133 +0xdc
github.com/objectbox/objectbox-go/test/performance.(*executor).initObjectBox(0xc0000edf48, 0x42b8f0c, 0x2)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/test/performance/perf.go:45 +0x11c
github.com/objectbox/objectbox-go/test/performance.createExecutor(...)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/test/performance/perf.go:38
github.com/objectbox/objectbox-go/test/performance.TestPerformanceSimple(0xc00012a800)
        /redacted/go/pkg/mod/github.com/objectbox/[email protected]/test/performance/perf_test.go:39 +0x19f
testing.tRunner(0xc00012a800, 0x42cebb8)
        /usr/local/go/src/testing/testing.go:909 +0xc9
created by testing.(*T).Run
        /usr/local/go/src/testing/testing.go:960 +0x350
FAIL    github.com/objectbox/objectbox-go/test/performance      0.023s
?       github.com/objectbox/objectbox-go/test/performance/perf [no test files]
FAIL

Test main.go:

package main

func main() {}

//go:generate go run github.com/objectbox/objectbox-go/cmd/objectbox-gogen

​type Task struct {
	Id   uint64
	Text string
}

Go generate execution:

go generate ./...
Generating ObjectBox bindings for main.go
can't parse GO file main.go: main.go:25:1: illegal character U+200B
exit status 2
main.go:23: running "go": exit status 1

I thought it was kinda weird that it had an install script with some build steps happening - is this not the correct instructions for using this as an embedded engine?

Ignore some structs for code generation

Is there a way to ignore some structsin a file when generating code. I am using gqlgen to generate my structs and I want to persist only some of them using objectbox.

cannot find module for path github.com/objectbox/objectbox-go/internal/generator

Use Go Version

$ go version
go version go1.13.1 darwin/amd64

I did it

$ GOARCH=arm GOOS=linux go build 
build go_api: cannot find module for path github.com/objectbox/objectbox-go/internal/generator

Go env is

$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/sasagawanoriyuki/Library/Caches/go-build"
GOENV="/Users/sasagawanoriyuki/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/sasagawanoriyuki/development/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/sasagawanoriyuki/.goenv/versions/1.13.1"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/sasagawanoriyuki/.goenv/versions/1.13.1/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/sasagawanoriyuki/development/go/src/go_api/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/m5/n0vxl48j0zq8vgbz3v9qqwfh0000gn/T/go-build230359227=/tmp/go-build -gno-record-gcc-switches -fno-common"

Query: OR condition

I know that Java's version of Objectbox supports OR condition in queries. Does Go version offers the same functionality at the moment?

Package issue.

I followed your steps and generated object box model. I also made a simple main.go file which contains:

package main

import (
"github.com/objectbox/objectbox-go/objectbox"
"github.com/objectbox/objectbox-go/examples/tasks/internal/model"
)

func initObjectBox() *objectbox.ObjectBox {
objectBox, err := objectbox.NewBuilder().Model(model.ObjectBoxModel()).Build()
return objectBox
}

func main() {
// load objectbox
ob := initObjectBox()
defer ob.Close() // In a server app, you would just keep ob and close on shutdown

box := model.BoxForTask(ob)

// Create
id, _ := box.Put(&model.Task{
Text: "Buy milk",
})

task, _ := box.Get(id) // Read
task.Text += " & some bread"
box.Put(task) // Update
box.Remove(task) // Delete
}

Pretty much the same code you provided in your tutorial. When i run:
pi@raspberrypi:~/internal/model $ go run main.go
I get:
main.go:5:2: use of internal package github.com/objectbox/objectbox-go/examples/tasks/internal/model not allowed.

go version go1.12.4 linux/arm.

Installation issue

After executing $ go get github.com/objectbox/objectbox-go/... in terminal I get the following error:

pi@raspberrypi:~ $ go get github.com/objectbox/objectbox-go/...
# github.com/objectbox/objectbox-go/objectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
/usr/bin/ld: cannot find -lobjectbox
collect2: error: ld returned 1 exit status

As you can see, I'm using Raspbian on Raspberry Pi 3 model B V1.2.
Any suggestions?
Thanks.

go generate not working

I'm in Windows 10, I installed everything as per the docs, but the go generate command does nothing, just runs and exits normally, but there are no files generated. I even try to run objectbox-gogen directly, but it prints out the help everytime even after specifying the -source file via flags, it just keeps printing the help.

Any thoughts on how to fix?

Build fails on CentOS 7 due to gcc not running c99 mode

Description

Running go build on a project using objectbox-go causes a compiler error when using gcc 4.8.5 on CentOS 7.

Basic info

  • ObjectBox version: 1.2.0
  • Reproducibility: always
  • Device: VPS
  • OS: CentOS 7

How to reproduce

Install gcc on CentOS yum install gcc
Install Objectbox (I used the bash quick install script here)
build a project that uses objectbox

Expected behavior

Project builds into executable

Logs, stack traces

# github.com/objectbox/objectbox-go/objectbox
/root/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/c-arrays.go: In function 'freeCharArray':
/root/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/c-arrays.go:32:5: error: 'for' loop initial declarations are only allowed in C99 mode
     for (size_t i = 0; i < size; i++) {
     ^
/root/go/pkg/mod/github.com/objectbox/[email protected]/objectbox/c-arrays.go:32:5: note: use option -std=c99 or -std=gnu99 to compile your code

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.