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

Add typed API to pkg/attribute #2486

Merged
merged 1 commit into from
Jun 18, 2020

Conversation

wangkuiyi
Copy link
Collaborator

Copy link
Collaborator

@tonyyang-svail tonyyang-svail left a comment

Choose a reason for hiding this comment

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

LGTM

Type: Int,
Default: value,
Doc: doc,
Checker: func(x interface{}) error { return checker(x.(int)) },
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here I should make it

func(x interface{}) error {
    v, ok := x(int)
    if ! ok {
         return fmt.Errorf("Attribute %s is of type int, but the value %v cannot be casted into int", name, x)
    }
    return checker(v)
}

@wangkuiyi wangkuiyi merged commit c33552b into sql-machine-learning:develop Jun 18, 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.

2 participants