小编Hal*_*ğan的帖子

带有关系 ID 的 Typeorm 插入

我使用 Typeorm,我只想使用relationId. 但它并没有像我预期的那样工作。

这是我的实体,

@Entity()
export default class Address extends BaseEntity {

    @Column({
        type: 'varchar',
        length: 255,
    })
    public title: number;

    @Column({
        type: 'varchar',
        length: 2000,
    })
    public value: number;

    @ManyToOne(type => User, user => user)
    @JoinColumn({ name: 'userId' })
    public user: User;

    @RelationId((address: Address) => address.user)
    public userId: number;

}
Run Code Online (Sandbox Code Playgroud)

当我尝试像下面的示例那样添加时,它添加了我不期望的 null userId

{
    "title": "My home address",
    "value": "Lorep Ipsum Sit Amet",
    "userId": 4
}

Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

当我更改有效负载时,一切正常。

{
    "title": "Ev adresim",
    "value": "Nova Suites",
    "user": 4
} …
Run Code Online (Sandbox Code Playgroud)

javascript orm typeorm

7
推荐指数
1
解决办法
7008
查看次数

如何在 iOS 的 React-Native 中混淆代码

我一直在尝试使用react-native-obfuscating-transformer来混淆代码一段时间。一切看起来都很好,但是当我检查bundle.js 时。我看不到任何混淆的代码。

PS:目前我只尝试IOS。

这是我的配置文件。

地铁配置.js


module.exports = {
    transformer: {
        babelTransformerPath: require.resolve('./transformer'),
        getTransformOptions: async () => ({
            transform: {
                experimentalImportSupport: false,
                inlineRequires: false,
            },
        }),
    },
};

Run Code Online (Sandbox Code Playgroud)

变压器.js

const obfuscatingTransformer = require('react-native-obfuscating-transformer');

module.exports = obfuscatingTransformer({
    upstreamTransformer: require('metro-react-native-babel-transformer'),
    enableInDevelopment: true,
    obfuscatorOptions: {
        compact: true,
        controlFlowFlattening: true,
        controlFlowFlatteningThreshold: 0.75,
        deadCodeInjection: true,
        deadCodeInjectionThreshold: 0.4,
        debugProtection: false,
        debugProtectionInterval: false,
        disableConsoleOutput: true,
        identifierNamesGenerator: 'hexadecimal',
        log: false,
        numbersToExpressions: true,
        renameGlobals: false,
        rotateStringArray: true,
        selfDefending: true,
        shuffleStringArray: true,
        simplify: true,
        splitStrings: true,
        splitStringsChunkLength: 10,
        stringArray: true, …
Run Code Online (Sandbox Code Playgroud)

javascript obfuscation react-native

5
推荐指数
1
解决办法
5546
查看次数

标签 统计

javascript ×2

obfuscation ×1

orm ×1

react-native ×1

typeorm ×1