Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making closure parameters non-escaping where possible (forEachRow etc) #2

Open
zmeyc opened this issue Jun 27, 2016 · 1 comment
Open
Assignees

Comments

@zmeyc
Copy link

zmeyc commented Jun 27, 2016

Please consider marking closures in methods such as forEachRow non escaping (@NoEscape attribute). They aren't capturing the closure anyway, but if this attribute is absent, closure requires prefixing member references with explicit 'self.'

            try DB.connection.forEachRow(statement: "SELECT * FROM topics_files WHERE user_id = ?", doBindings: { statement in
                try statement.bind(position: 0, self.userId!) // <---- self.
            }) { statement, row in
                self.topicsData = statement.columnBlob(position: 0) // <---- self.
            }
    public func forEachRow(statement: String, doBindings: @noescape (SQLiteStmt) throws -> (), handleRow: @noescape (SQLiteStmt, Int) -> ()) throws {}
...
    func forEachRowBody(stat: SQLiteStmt, handleRow: @noescape (SQLiteStmt, Int) -> ()) throws {}
...
etc
@iamjono
Copy link
Member

iamjono commented Jul 3, 2016

Good call. Feel free to submit a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants