How to use the typeorm/util/StringUtils.snakeCase function in typeorm

To help you get started, we’ve selected a few typeorm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NarHakobyan / awesome-nest-boilerplate / src / snake-naming.strategy.ts View on Github external
columnName(
        propertyName: string,
        customName: string,
        embeddedPrefixes: string[],
    ): string {
        return (
            snakeCase(embeddedPrefixes.join('_')) +
            (customName ? customName : snakeCase(propertyName))
        );
    }
github goldcaddy77 / warthog / src / torm / SnakeNamingStrategy.ts View on Github external
columnName(propertyName: string, customName?: string, embeddedPrefixes: string[] = []): string {
    return (
      snakeCase(embeddedPrefixes.join('_')) + (customName ? customName : snakeCase(propertyName))
    );
  }
github magishift / magishift.core / packages / config / src / database / snakeNaming.config.ts View on Github external
uniqueConstraintName(tableOrName: string, columnNames: string[]): string {
    return snakeCase('uq_' + tableOrName + columnNames.map(column => '_' + column));
  }
github magishift / magishift.core / packages / config / src / database / snakeNaming.config.ts View on Github external
columnName(propertyName: string, customName: string, embeddedPrefixes: string[]): string {
    return snakeCase(embeddedPrefixes.join('_')) + (customName ? customName : snakeCase(propertyName));
  }
github NarHakobyan / awesome-nest-boilerplate / src / snake-naming.strategy.ts View on Github external
joinTableName(
        firstTableName: string,
        secondTableName: string,
        firstPropertyName: string,
        _secondPropertyName: string,
    ): string {
        return snakeCase(
            firstTableName +
                '_' +
                firstPropertyName.replace(/\./gi, '_') +
                '_' +
                secondTableName,
        );
    }
github magishift / magishift.core / packages / config / src / database / snakeNaming.config.ts View on Github external
foreignKeyName(tableOrName: string, columnNames: string[]): string {
    return snakeCase('fk_' + tableOrName + columnNames.map(column => '_' + column));
  }
github NarHakobyan / awesome-nest-boilerplate / src / snake-naming.strategy.ts View on Github external
joinColumnName(relationName: string, referencedColumnName: string): string {
        return snakeCase(relationName + '_' + referencedColumnName);
    }
github Mando75 / typeorm-graphql-loader / src / base.ts View on Github external
protected formatAliasField(alias: string, field: string): string {
    switch (this.namingStrategy) {
      case LoaderNamingStrategyEnum.SNAKECASE:
        return `${alias}_${snakeCase(field)}`;
      case LoaderNamingStrategyEnum.CAMELCASE:
        return `${alias}_${field}`;
      default:
        return `${alias}_${field}`;
    }
  }
github NarHakobyan / awesome-nest-boilerplate / src / snake-naming.strategy.ts View on Github external
classTableInheritanceParentColumnName(
        parentTableName: any,
        parentTableIdPropertyName: any,
    ): string {
        return snakeCase(parentTableName + '_' + parentTableIdPropertyName);
    }
}
github goldcaddy77 / warthog / src / torm / SnakeNamingStrategy.ts View on Github external
joinTableColumnName(tableName: string, propertyName: string, columnName?: string): string {
    return snakeCase(`${tableName}_${columnName ? columnName : propertyName}`);
  }