Skip to content

Commit

Permalink
chore: reduce statement return type (#1128)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 authored Apr 26, 2024
1 parent 2a1a4ab commit 07da8ef
Show file tree
Hide file tree
Showing 75 changed files with 76 additions and 112 deletions.
2 changes: 1 addition & 1 deletion src/operations/domains/alterDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface DomainOptionsAlter extends DomainOptions {
export type AlterDomain = (
domainName: Name,
domainOptions: DomainOptionsAlter
) => string | string[];
) => string;

export function alterDomain(mOptions: MigrationOptions): AlterDomain {
const _alter: AlterDomain = (domainName, options) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/domains/createDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type CreateDomainFn = (
domainName: Name,
type: Type,
domainOptions?: DomainOptionsCreate & DropOptions
) => string | string[];
) => string;

export type CreateDomain = Reversible<CreateDomainFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/domains/dropDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { DropOptions, Name } from '../generalTypes';
export type DropDomain = (
domainName: Name,
dropOptions?: DropOptions
) => string | string[];
) => string;

export function dropDomain(mOptions: MigrationOptions): DropDomain {
const _drop: DropDomain = (domainName, options = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/domains/renameDomain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Name, Reversible } from '../generalTypes';
export type RenameDomainFn = (
oldDomainName: Name,
newDomainName: Name
) => string | string[];
) => string;

export type RenameDomain = Reversible<RenameDomainFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/functions/createFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type CreateFunctionFn = (
functionParams: FunctionParam[],
functionOptions: FunctionOptions & DropOptions,
definition: Value
) => string | string[];
) => string;

export type CreateFunction = Reversible<CreateFunctionFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/functions/dropFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type DropFunction = (
functionName: Name,
functionParams: FunctionParam[],
dropOptions?: DropOptions
) => string | string[];
) => string;

export function dropFunction(mOptions: MigrationOptions): DropFunction {
const _drop: DropFunction = (
Expand Down
2 changes: 1 addition & 1 deletion src/operations/functions/renameFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type RenameFunctionFn = (
oldFunctionName: Name,
functionParams: FunctionParam[],
newFunctionName: Name
) => string | string[];
) => string;

export type RenameFunction = Reversible<RenameFunctionFn>;

Expand Down
4 changes: 1 addition & 3 deletions src/operations/grants/grantOnSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ export type GrantOnSchemasOptions = OnlyGrantOnSchemasOptions &
WithGrantOption &
RevokeOnObjectsOptions;

export type GrantOnSchemasFn = (
options: GrantOnSchemasOptions
) => string | string[];
export type GrantOnSchemasFn = (options: GrantOnSchemasOptions) => string;

export type GrantOnSchemas = Reversible<GrantOnSchemasFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/grants/grantOnTables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export type GrantOnTablesOptions =

export type GrantOnTablesFn = (
options: GrantOnTablesOptions & RevokeOnObjectsOptions
) => string | string[];
) => string;

export type GrantOnTables = Reversible<GrantOnTablesFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/grants/grantRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export type GrantRolesFn = (
rolesFrom: Name | Name[],
rolesTo: Name | Name[],
grantRolesOptions?: GrantRolesOptions
) => string | string[];
) => string;

export type GrantRoles = GrantRolesFn & { reverse: GrantRolesFn };

Expand Down
4 changes: 1 addition & 3 deletions src/operations/grants/revokeOnSchemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ import { asRolesStr } from './shared';
export type RevokeOnSchemasOptions = OnlyGrantOnSchemasOptions &
RevokeOnObjectsOptions;

export type RevokeOnSchemas = (
options: RevokeOnSchemasOptions
) => string | string[];
export type RevokeOnSchemas = (options: RevokeOnSchemasOptions) => string;

export function revokeOnSchemas(mOptions: MigrationOptions): RevokeOnSchemas {
const _revokeOnSchemas: RevokeOnSchemas = ({
Expand Down
4 changes: 1 addition & 3 deletions src/operations/grants/revokeOnTables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export type RevokeOnTablesOptions = CommonOnTablesOptions &
(AllTablesOptions | SomeTablesOptions) &
RevokeOnObjectsOptions;

export type RevokeOnTables = (
options: RevokeOnTablesOptions
) => string | string[];
export type RevokeOnTables = (options: RevokeOnTablesOptions) => string;

export function revokeOnTables(mOptions: MigrationOptions): RevokeOnTables {
const _revokeOnTables: RevokeOnTables = (options) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/grants/revokeRoles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export type RevokeRoles = (
roles: Name | Name[],
rolesFrom: Name | Name[],
revokeRolesOptions?: RevokeRolesOptions
) => string | string[];
) => string;

export function revokeRoles(mOptions: MigrationOptions): RevokeRoles {
const _revokeRoles: RevokeRoles = (roles, rolesFrom, options) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/indexes/createIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export type CreateIndexFn = (
tableName: Name,
columns: string | Array<string | IndexColumn>,
options?: CreateIndexOptions & DropIndexOptions
) => string | string[];
) => string;

export type CreateIndex = Reversible<CreateIndexFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/indexes/dropIndex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export type DropIndex = (
tableName: Name,
columns: string | Array<string | IndexColumn>,
options?: DropIndexOptions
) => string | string[];
) => string;

export function dropIndex(mOptions: MigrationOptions): DropIndex {
const _drop: DropIndex = (tableName, rawColumns, options = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/materializedViews/alterMaterializedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export interface AlterMaterializedViewOptions {
export type AlterMaterializedView = (
viewName: Name,
options: AlterMaterializedViewOptions
) => string | string[];
) => string;

export function alterMaterializedView(
mOptions: MigrationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/operations/materializedViews/createMaterializedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export type CreateMaterializedViewFn = (
viewName: Name,
options: CreateMaterializedViewOptions & DropOptions,
definition: string
) => string | string[];
) => string;

export type CreateMaterializedView = Reversible<CreateMaterializedViewFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/materializedViews/dropMaterializedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { DropOptions, Name } from '../generalTypes';
export type DropMaterializedView = (
viewName: Name,
options?: DropOptions
) => string | string[];
) => string;

export function dropMaterializedView(
mOptions: MigrationOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface RefreshMaterializedViewOptions {
export type RefreshMaterializedViewFn = (
viewName: Name,
options?: RefreshMaterializedViewOptions
) => string | string[];
) => string;

export type RefreshMaterializedView = Reversible<RefreshMaterializedViewFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/materializedViews/renameMaterializedView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Name, Reversible } from '../generalTypes';
export type RenameMaterializedViewFn = (
viewName: Name,
newViewName: Name
) => string | string[];
) => string;

export type RenameMaterializedView = Reversible<RenameMaterializedViewFn>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type RenameMaterializedViewColumnFn = (
viewName: Name,
columnName: string,
newColumnName: string
) => string | string[];
) => string;

export type RenameMaterializedViewColumn =
Reversible<RenameMaterializedViewColumnFn>;
Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/addToOperatorFamily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export type AddToOperatorFamilyFn = (
operatorFamilyName: Name,
indexMethod: Name,
operatorList: OperatorListDefinition[]
) => string | string[];
) => string;

export type AddToOperatorFamily = Reversible<AddToOperatorFamilyFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/createOperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface CreateOperatorOptions {
export type CreateOperatorFn = (
operatorName: Name,
options: CreateOperatorOptions & DropOperatorOptions
) => string | string[];
) => string;

export type CreateOperator = Reversible<CreateOperatorFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/createOperatorClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export type CreateOperatorClassFn = (
indexMethod: Name,
operatorList: OperatorListDefinition[],
options: CreateOperatorClassOptions & DropOptions
) => string | string[];
) => string;

export type CreateOperatorClass = Reversible<CreateOperatorClassFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/createOperatorFamily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export type CreateOperatorFamilyFn = (
operatorFamilyName: Name,
indexMethod: Name,
options?: DropOptions
) => string | string[];
) => string;

export type CreateOperatorFamily = Reversible<CreateOperatorFamilyFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/dropOperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface DropOperatorOptions extends DropOptions {
export type DropOperator = (
operatorName: Name,
dropOptions?: DropOperatorOptions
) => string | string[];
) => string;

export function dropOperator(mOptions: MigrationOptions): DropOperator {
const _drop: DropOperator = (operatorName, options = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/dropOperatorClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type DropOperatorClass = (
operatorClassName: Name,
indexMethod: Name,
dropOptions?: DropOptions
) => string | string[];
) => string;

export function dropOperatorClass(
mOptions: MigrationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/dropOperatorFamily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type DropOperatorFamily = (
operatorFamilyName: Name,
newSchemaName: Name,
dropOptions?: DropOptions
) => string | string[];
) => string;

export function dropOperatorFamily(
mOptions: MigrationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/removeFromOperatorFamily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type RemoveFromOperatorFamily = (
operatorFamilyName: Name,
indexMethod: Name,
operatorList: OperatorListDefinition[]
) => string | string[];
) => string;

export const removeFromOperatorFamily = (
mOptions: MigrationOptions
Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/renameOperatorClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type RenameOperatorClassFn = (
oldOperatorClassName: Name,
indexMethod: Name,
newOperatorClassName: Name
) => string | string[];
) => string;

export type RenameOperatorClass = Reversible<RenameOperatorClassFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/operators/renameOperatorFamily.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type RenameOperatorFamilyFn = (
oldOperatorFamilyName: Name,
indexMethod: Name,
newOperatorFamilyName: Name
) => string | string[];
) => string;

export type RenameOperatorFamily = Reversible<RenameOperatorFamilyFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/policies/alterPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type AlterPolicy = (
tableName: Name,
policyName: string,
options: PolicyOptions
) => string | string[];
) => string;

export function alterPolicy(mOptions: MigrationOptions): AlterPolicy {
const _alter: AlterPolicy = (tableName, policyName, options = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/policies/createPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ type CreatePolicyFn = (
tableName: Name,
policyName: string,
options?: CreatePolicyOptions & IfExistsOption
) => string | string[];
) => string;

export type CreatePolicy = Reversible<CreatePolicyFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/policies/dropPolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type DropPolicy = (
tableName: Name,
policyName: string,
options?: IfExistsOption
) => string | string[];
) => string;

export function dropPolicy(mOptions: MigrationOptions): DropPolicy {
const _drop: DropPolicy = (tableName, policyName, options = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/policies/renamePolicy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export type RenamePolicyFn = (
tableName: Name,
policyName: string,
newPolicyName: string
) => string | string[];
) => string;

export type RenamePolicy = Reversible<RenamePolicyFn>;

Expand Down
5 changes: 1 addition & 4 deletions src/operations/roles/alterRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import type { Name } from '../generalTypes';
import type { RoleOptions } from './shared';
import { formatRoleOptions } from './shared';

export type AlterRole = (
roleName: Name,
roleOptions: RoleOptions
) => string | string[];
export type AlterRole = (roleName: Name, roleOptions: RoleOptions) => string;

export function alterRole(mOptions: MigrationOptions): AlterRole {
const _alter: AlterRole = (roleName, roleOptions = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/roles/createRole.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { formatRoleOptions } from './shared';
export type CreateRoleFn = (
roleName: Name,
roleOptions?: RoleOptions & IfExistsOption
) => string | string[];
) => string;

export type CreateRole = Reversible<CreateRoleFn>;

Expand Down
5 changes: 1 addition & 4 deletions src/operations/roles/dropRole.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { MigrationOptions } from '../../types';
import type { IfExistsOption, Name } from '../generalTypes';

export type DropRole = (
roleName: Name,
options?: IfExistsOption
) => string | string[];
export type DropRole = (roleName: Name, options?: IfExistsOption) => string;

export function dropRole(mOptions: MigrationOptions): DropRole {
const _drop: DropRole = (roleName, options = {}) => {
Expand Down
5 changes: 1 addition & 4 deletions src/operations/roles/renameRole.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import type { MigrationOptions } from '../../types';
import type { Name, Reversible } from '../generalTypes';

export type RenameRoleFn = (
oldRoleName: Name,
newRoleName: Name
) => string | string[];
export type RenameRoleFn = (oldRoleName: Name, newRoleName: Name) => string;

export type RenameRole = Reversible<RenameRoleFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/schemas/createSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface CreateSchemaOptions extends IfNotExistsOption {
export type CreateSchemaFn = (
schemaName: string,
schemaOptions?: CreateSchemaOptions & DropOptions
) => string | string[];
) => string;

export type CreateSchema = Reversible<CreateSchemaFn>;

Expand Down
2 changes: 1 addition & 1 deletion src/operations/schemas/dropSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { DropOptions } from '../generalTypes';
export type DropSchema = (
schemaName: string,
dropOptions?: DropOptions
) => string | string[];
) => string;

export function dropSchema(mOptions: MigrationOptions): DropSchema {
const _drop: DropSchema = (schemaName, options = {}) => {
Expand Down
2 changes: 1 addition & 1 deletion src/operations/schemas/renameSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type { Reversible } from '../generalTypes';
export type RenameSchemaFn = (
oldSchemaName: string,
newSchemaName: string
) => string | string[];
) => string;

export type RenameSchema = Reversible<RenameSchemaFn>;

Expand Down
Loading

0 comments on commit 07da8ef

Please sign in to comment.