King River Lee
11/03/2023, 2:36 PMJoffrey
11/03/2023, 2:37 PMString
class implement your custom interface? This is not possible at the momentKing River Lee
11/03/2023, 2:38 PMSam
11/03/2023, 2:38 PMJoffrey
11/03/2023, 2:38 PMKing River Lee
11/03/2023, 2:38 PMKing River Lee
11/03/2023, 2:39 PMinterface Selectable
King River Lee
11/03/2023, 2:41 PMJoffrey
11/03/2023, 2:44 PMString
?King River Lee
11/03/2023, 2:48 PMSelectable
interface as param. Assume Class Column
impl Selectable
, so I can pass Column to the fun. Like SQL SELECT Selectable
. so I want to let String
Impl Selectable
for some more common way to select.Joffrey
11/03/2023, 2:50 PMinit
block to perform validation on the string, because surely not any arbitrary string should be considered a Selectable
, right?King River Lee
11/03/2023, 2:52 PMKing River Lee
11/03/2023, 2:52 PMJoffrey
11/03/2023, 2:52 PMyourFunction(Sql("SELECT Selectable"))
(if we define value class Sql(val text: String) : Selectable
)Klitos Kyriacou
11/03/2023, 3:34 PMSelectable
is anything that can be a parameter to SELECT
- such as a column name or, indeed, any String literal. After all, both SELECT mycolumn FROM mytable
and SELECT 'any arbitrary string'
are both valid statements.Joffrey
11/03/2023, 3:37 PMSELECT
is the string that is passed to the function. Nevertheless, I still believe it's worth using a type-safe column/selectable type for this, and maybe a simple string wrapper for a column name: yourFunction(ColumnName("Selectable"))
King River Lee
11/05/2023, 10:42 AMSelectable
can be param of myFun(selectable: Selectable)