每当我查看Lisp的编辑器时,Emacs都不可避免地首先出现.从一个对Emacs不太了解的人的角度来看,是什么让它与Vim,Eclipse等相比更加出色呢?
我正在使用SQLAlchemy在PostgreSQL数据库中的特定模式下生成表。如果该架构不存在,我想创建它。我知道PostgreSQL查询来检查架构的存在:
SELECT exists(select schema_name FROM information_schema.schemata WHERE schema_name = 'foo')
Run Code Online (Sandbox Code Playgroud)
但我想知道如何使用SQLAlchemy处理此问题。
我正在寻找一种方法来计算我的对象类型的哪些部分在我的代码库中实际使用。假设我的types.ts文件中有以下内容:
export type Animal = {
id: number;
name: string;
height: number;
isMammal: boolean;
}
Run Code Online (Sandbox Code Playgroud)
在另一个文件中,我进行了一个返回 Animal 的 API 调用:
const getAnimal: (id: number) => Promise<Animal>
Run Code Online (Sandbox Code Playgroud)
在两个单独的文件中,我调用getAnimal并使用生成的Animal.
const animal1 = await getAnimal(1);
console.log(`Hi! Animal with id ${animal1.id} is named ${animal1.name}.`)
Run Code Online (Sandbox Code Playgroud)
const animal1 = await getAnimal(1);
console.log(`This animal is ${animal1.height} feet tall.`)
Run Code Online (Sandbox Code Playgroud)
但在我的项目中,我没有使用该isMammal属性。如何编写一个脚本来扫描项目中的所有文件并告诉我该类型isMammal未使用该Animal文件?或者,只有id、name、 和height 是?