How can I get the list of a columns in a table for a SQLite database?

What you’re looking for is called the data dictionary. In sqlite a list of all tables can be found by querying sqlite_master table (or view?) sqlite> create table people (first_name varchar, last_name varchar, email_address varchar); sqlite> select * from sqlite_master; table|people|people|2|CREATE TABLE people (first_name varchar, last_name varchar, email_address varchar) To get column information you can … Read more

Go reflection with interface embedded in struct – how to detect “real” functions?

You needn’t reflection to my mind method_in_table := B.Foo fmt.Printf(“%T \n”, method_in_table) will output you func(main.B) string Interface type A initialized at predeclared nil which has no dynamic type var a A if a==nil{ fmt.Printf(“It’s nil”) } a.Foo() will give you same error. So practical check can be just if b.A != nil { b.Foo()}

Scala: How do I dynamically instantiate an object and invoke a method using reflection?

There is an easier way to invoke method reflectively without resorting to calling Java reflection methods: use Structural Typing. Just cast the object reference to a Structural Type which has the necessary method signature then call the method: no reflection necessary (of course, Scala is doing reflection underneath but we don’t need to do it). … Read more

Getting method parameter names

There is no way to get the names of the parameters of a method or a function. The reason for this is because the names are not really important for someone calling a method or a function. What matters is the types of the parameters and their order. A Function type denotes the set of … Read more

How does Rust implement reflection?

First of all, Rust doesn’t have reflection; reflection implies you can get details about a type at runtime, like the fields, methods, interfaces it implements, etc. You can not do this with Rust. The closest you can get is explicitly implementing (or deriving) a trait that provides this information. Each type gets a TypeId assigned … Read more