Created
September 21, 2020 23:19
-
-
Save Ch4s3/8100fa09ab947e1def24685130a3aa5c to your computer and use it in GitHub Desktop.
select/2 explaination
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from(c in City, select: c) # returns the schema as a struct | |
from(c in City, select: {c.name, c.population}) # returns Tuple of {name, population} | |
from(c in City, select: [c.name, c.county]) # returns List of [name, county] | |
from(c in City, select: %{n: c.name, answer: 42}) # returns Map with keys :n, and :answer | |
from(c in City, select: %{c | alternative_name: c.name}) # returns the schema as a Struct with :alternative_name added | |
from(c in City, select: %Data{name: c.name}) # returns the selected name in %Data{} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment