SQLite.swift icon indicating copy to clipboard operation
SQLite.swift copied to clipboard

is there has anyway to implement "glob * || field" ?

Open coder-free opened this issue 1 year ago • 0 comments

my sql is: SELECT * FROM table where '$domain' GLOB '*' || field order by id desc

I want codable result.

may like this?:


    
    /// Builds a copy of the expression appended with a `GLOB` query against the
    /// given pattern.
    ///
    ///     let path = Expression<String>("path")
    ///     path.rglob_asterisk("*.png")
    ///     // '*.png' GLOB '*' || "path"
    ///
    /// - Parameter pattern: A pattern to match.
    ///
    /// - Returns: A copy of the expression appended with a `GLOB` query against
    ///   the given pattern.
    public func rglob_asterisk(_ pattern: String) -> Expression<Bool> {
        Function.glob.infix(pattern, "'*' || \(self)".expression)
    }

coder-free avatar Mar 25 '23 04:03 coder-free