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

Implement https://github.com/crystal-lang/crystal-db/pull/9 #1

Merged
merged 1 commit into from Jul 1, 2016

Conversation

asterite
Copy link
Member

No description provided.

{% for t in DB::TYPES %}
def read?(t : {{t}}.class) : {{t}}?
read_if_not_nil do |row_packet, col|
@columns[col].column_type.read(row_packet).as({{t}})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if each column_type implements a Column(T) mixin that stats def read : T maybe we could leave

@columns[col].column_type.as(Column(T)).read(row_packet)

in order to avoid the implicit unions due to return types.
Yet some overloads for the nillable types will be needed.

@asterite WDYT?

the current PR is not worse that what we currently have due to the implicit unions. So we should be fine.

@asterite asterite merged commit 4f64d62 into master Jul 1, 2016
@bcardiff bcardiff deleted the feature/simple_read branch March 21, 2017 18:45
bcardiff pushed a commit to bcardiff/crystal-mysql that referenced this pull request Oct 5, 2020
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

Successfully merging this pull request may close these issues.

None yet

2 participants