objectbox / objectbox/objectbox-swift

There is a compilation error with Entity.id.isEqual(to:id)

Open
#90 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
619
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Is there an existing issue?
Build info
  • ObjectBox version: [4.1.0]
  • OS: IOS 17
  • Device/chipset: iPhone 15
Steps to reproduce
  1. my class:
// objectbox: entity
class OneEntity :{
    var id: Id = 0
    
    var text: String?
    init(){}
  
}

query code:

func query(id: Id) -> [OneEntity] {
        do {
            let query: Query<OneEntity>?

            query = try entityDataBox?.query {OneEntity.id.isEqual(to: id) }
                .build()

            
            if let result = try query?.find(limit: 15) {
                return result
            }
            
            return []
        } catch {
            print("query fail, err:\(error)")
            return []
        }
    }

I encountered a compilation error at OneEntity.id.isEqual(to: id) here:
Ambiguous use of 'isEqual(to:)'

Expected behavior

I expect OneEntity.id.isEqual(to: id) should work

Actual behavior

Compilation error

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the compilation error in the OneEntity.id.isEqual(to: id) query shown in the issue using ObjectBox 4.1.0 on iOS 17. Inspect the query expression and its available overloads, then verify that the query compiles and returns the matching OneEntity records without the ambiguous-use error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
databases, mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.