Data processing method, device and equipment, computer readable storage medium and computer program product

By constructing the target structure in the first programming language to call the server application in the second programming language, the calling barrier between different programming languages ​​is solved, improving development efficiency and convenience.

CN120832128APending Publication Date: 2025-10-24TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410505250.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-04-24
Publication Date
2025-10-24

AI Technical Summary

Technical Problem

Because the programming languages ​​of the basic services in the server-side application are different from those in the front-end development, they cannot be called directly. Existing technologies require rewriting the server-side application, resulting in low development efficiency.

Method used

By receiving object data in the first programming language, determining the data type of each attribute value, and constructing the target structure in the second programming language based on these types, the second application service can be directly invoked, avoiding the need to rewrite the programming language of the second application service.

Benefits of technology

It improves application development efficiency, reduces repetitive work, and improves the convenience of program development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120832128A_ABST
    Figure CN120832128A_ABST
Patent Text Reader

Abstract

The invention provides a data processing method, device and equipment, a computer readable storage medium and a computer program product. The method comprises the steps that in response to a calling request of a first application service for a second application service, object data constructed through a first programming language is received, and the object data comprises multiple attributes of an object and the attribute value of each attribute; obtaining a first data type of each attribute value in the object data, and determining a second data type corresponding to each attribute value in a second programming language based on the first data type of each attribute value; based on the object data and the first data type and the second data type of each attribute value, determining a target structural body constructed by using a second programming language; and calling the second application service based on the target structure body. Through the application, the object in the first programming language can be converted into the target structure body in the second programming language, so that the application development efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computer, and particularly relates to a data processing method and device, equipment, computer readable storage medium and computer program product. BACKGROUND

[0002] With the development of computer technology, developers can start to use the programming language of front-end development to develop the server application. However, the programming language of the basic service in the server application is different from the programming language of front-end development, which leads to the inability to directly call the basic service in the server application.

[0003] In the related art, the basic service in the server application is generally reprogrammed using the programming language of front-end development, but the above method has a large workload, which leads to low application development efficiency. SUMMARY

[0004] The embodiments of the present application provide a data processing method and device, computer readable storage medium and computer program product, which can convert an object in a first programming language into a target structure in a second programming language when calling a second application service written in the second programming language in a first application service written in the first programming language, thereby realizing calling the second application service through the first programming language and improving the application development efficiency.

[0005] The technical solution of the embodiments of the present application is as follows:

[0006] The embodiments of the present application provide a data processing method, which comprises: in response to a calling request of a first application service to a second application service, receiving object data constructed by a first programming language, wherein the object data comprises a plurality of attributes of an object and attribute values of each attribute, the first application service is implemented by using the first programming language, and the second application service is implemented by using a second programming language; acquiring a first data type of each attribute value in the object data, and determining a second data type corresponding to each attribute value in the second programming language based on the first data type of each attribute value; determining a target structure constructed by the second programming language based on the object data and the first data type and the second data type of each attribute value; and calling the second application service based on the target structure.

[0007] The embodiment of the present application provides a data processing device, the device comprises: a data receiving module, configured to receive object data constructed by using a first programming language in response to a calling request of a first application service to a second application service, the object data comprising a plurality of attributes of an object and attribute values of each attribute, the first application service being implemented by using the first programming language, and the second application service being implemented by using a second programming language; a data type determining module, configured to acquire a first data type of each attribute value in the object data, and determine a second data type corresponding to each attribute value in the second programming language based on the first data type of each attribute value; a structure body determining module, configured to determine a target structure body constructed by using the second programming language based on the object data and the first data type and the second data type of each attribute value; and a service calling module, configured to call the second application service based on the target structure body.

[0008] In some embodiments, the structure body determining module is further configured to determine, for each attribute in the object data, a memory address pointer corresponding to the attribute based on the first data type of the attribute value of the attribute; and store the plurality of attributes and the attribute values of each attribute according to the memory address pointer and the second data type corresponding to each attribute, to obtain the target structure body constructed by using the second programming language.

[0009] In some embodiments, the structure body determining module is further configured to convert the object data into a first object structure body constructed by using a third programming language through a target programming interface; construct index data by using the third programming language based on the first object structure body and the first data type of each attribute value; the index data comprising the plurality of attributes, the attribute values of each attribute, and a third data type corresponding to the first data type of each attribute value in the third programming language; and determine the target structure body constructed by using the second programming language based on the index data and the second data type of each attribute value.

[0010] In some embodiments, each first data type has a corresponding type identifier; the structure body determining module is further configured to acquire, for each attribute, the attribute value of the attribute from the first object structure body; acquire the type identifier corresponding to the first data type of the attribute value; construct attribute data of the attribute by using the third programming language based on the attribute value and the type identifier corresponding to the first data type of the attribute value; and determine index data based on the first object structure body and the attribute data of each attribute.

[0011] In some embodiments, the structure determining module is further configured to determine, when the type identifier corresponding to the first data type of the attribute value is a first preset identifier, a third data type in the third programming language corresponding to the first preset identifier; determine the attribute value and the third data type of the attribute value as the attribute data of the attribute; and when the type identifier corresponding to the first data type of the attribute value is a second preset identifier, obtain a second object structure corresponding to the second preset identifier, and determine the attribute data of the attribute based on the second object structure.

[0012] In some embodiments, the structure determining module is further configured to obtain, from the first object structure, a plurality of attributes arranged in a first order, and determine the plurality of attributes as a plurality of target keys; for each target key, determine the attribute data of the target key as a target value having a mapping relationship with the target key; and store each target key and the target value corresponding to each target key in the first order to obtain the index data.

[0013] In some embodiments, the structure determining module is further configured to, for each attribute, obtain the attribute value of the attribute and the third data type of the attribute value from the index data; determine, based on the third data type of each attribute value, a memory address pointer corresponding to each attribute; and store the plurality of attributes and the attribute value of each attribute according to the memory address pointer corresponding to each attribute and the second data type of each attribute value to obtain a target structure constructed using the second programming language.

[0014] In some embodiments, the structure determining module is further configured to determine, based on the third data type of each attribute value, a memory space and alignment data corresponding to each attribute; determine a target alignment data as the largest memory space in the memory spaces corresponding to the plurality of attributes; determine a target initial address of the target structure in the memory based on the target alignment data; and determine a memory address pointer corresponding to each attribute based on the target initial address and the memory space and alignment data corresponding to each attribute.

[0015] In some embodiments, the structure determining module is further configured to obtain initial address data of the target structure allocated in the memory; when the initial address data is an integer multiple of the target alignment data, determine the initial address data as the target initial address; when the initial address data is a non-integer multiple of the target alignment data, obtain first padding data; the sum of the initial address data and the first padding data is an integer multiple of the target alignment data; and determine the sum of the initial address data and the first padding data as the target initial address of the target structure in the memory.

[0016] In some embodiments, the structure determining module is further configured to, for the i-th attribute, determine a start address pointer of the i-th attribute based on the memory address pointer of the (i-1)-th attribute and the memory space, where i is an integer greater than 1, and the start address pointer of the first attribute is the target initial address; determine second padding data of the i-th attribute based on the start address pointer of the i-th attribute and the alignment data; and determine a memory address pointer of the i-th attribute as a sum of the start address pointer of the i-th attribute and the second padding data.

[0017] Embodiments of the present application provide an electronic device, which comprises a memory configured to store computer executable instructions or computer programs; and a processor configured to execute the computer executable instructions or computer programs stored in the memory to implement the data processing method provided by the embodiments of the present application.

[0018] Embodiments of the present application provide a computer readable storage medium storing computer programs or computer executable instructions, which are configured to be executed by a processor to implement the data processing method provided by the embodiments of the present application.

[0019] Embodiments of the present application provide a computer program product comprising computer programs or computer executable instructions, which are configured to be executed by a processor to implement the data processing method provided by the embodiments of the present application.

[0020] Embodiments of the present application have the following beneficial effects:

[0021] In the scenario that a first application service written in a first programming language calls a second application service written in a second programming language, the first data type of each attribute value in the object data constructed by the first programming language can be obtained, the second data type corresponding to the first data type in the second programming language can be determined, and the target structure can be constructed by the second programming language based on the object data and the first data type and the second data type of each attribute value, so as to implement the conversion of the object in the first programming language into the target structure in the second programming language. Since the target structure and the second application service are both implemented by the second programming language, the second application service can be directly called based on the target structure, thereby realizing the calling of the second application service by the first programming language, without the need to repeatedly write the second application service by the first programming language, reducing the workload required for application development, thereby improving the application development efficiency. Meanwhile, the embodiments of the present application can also realize the development of the application program implemented by the second programming language by the first programming language, thereby improving the convenience of program development. BRIEF DESCRIPTION OF DRAWINGS

[0022] Figure 1 FIG. 1 is a structural schematic diagram of a data processing system architecture provided by embodiments of the present application;

[0023] Figure 2 FIG. 1 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;

[0024] Figure 3 FIG. 2 is a first flow schematic diagram of a data processing method provided by an embodiment of the present application;

[0025] Figure 4 FIG. 3 is a second flow schematic diagram of a data processing method provided by an embodiment of the present application;

[0026] Figure 5 FIG. 4 is a third flow schematic diagram of a data processing method provided by an embodiment of the present application;

[0027] Figure 6 FIG. 5 is a fourth flow schematic diagram of a data processing method provided by an embodiment of the present application;

[0028] Figure 7 FIG. 6 is a schematic diagram of a description relationship of a person structure in a memory provided by an embodiment of the present application.

[0029] It should be noted that the above-mentioned "first", "second", "third" and "fourth" are only used to distinguish different schemes, and do not represent the advantages or disadvantages of the schemes or the priority in the implementation process. DETAILED DESCRIPTION

[0030] In order to make the purpose, technical scheme and advantages of the present application clearer, the present application will be further described in detail below in combination with the drawings, and the described embodiments should not be regarded as limiting the present application, and all other embodiments obtained by a person of ordinary skill in the art without making creative labor are within the scope of protection of the present application.

[0031] In the following description, "some embodiments" are described, which describe a subset of all possible embodiments, but it can be understood that "some embodiments" can be the same subset or different subset of all possible embodiments, and can be combined with each other without conflict.

[0032] In the following description, the terms "first\second\third" are only used to distinguish similar objects, and do not represent a specific order of the objects, and it can be understood that the "first\second\third" can be interchanged with a specific order or sequence as allowed, so that the embodiments of the present application described here can be implemented in an order other than that illustrated or described here.

[0033] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined target, and can be implemented entirely or partially by using software, hardware (such as a processing circuit or a memory) or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an integral module or unit that includes the functions of the module or unit.

[0034] Unless otherwise defined, all technical and scientific terms used in the embodiments of the present application have the same meanings as commonly understood by one of ordinary skill in the art. The terms used in the embodiments of the present application are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0035] The relevant data collection process in the embodiments of the present application should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and within the scope of authorization of laws and regulations and the personal information subject, carry out subsequent data use and processing.

[0036] Before further detailing the embodiments of the present application, the terms and phrases involved in the embodiments of the present application are explained, and the terms and phrases involved in the embodiments of the present application are applicable to the following explanations.

[0037] 1) Rust: A system-level programming language designed to provide a balance of safety, concurrency, and performance. Developers using the Rust language can write efficient, reliable, and concurrent software.

[0038] 2) JavaScript (JS): A scripting language commonly used to implement interactive features on web pages. It is a dynamically typed, interpreted language used to manipulate web page elements and achieve dynamic effects in web browsers. Over time, JavaScript has evolved into a general-purpose programming language that can be used to develop front-end, back-end, and mobile applications in various application areas.

[0039] 3) C++: A general-purpose programming language that extends from C language and adds object-oriented programming and other features, aiming to provide an efficient, portable, and extensible system-level programming language.

[0040] 4) Node.js: A JavaScript runtime environment based on ChromeV8 engine, used to run JavaScript code on the server side, which allows developers to use JavaScript language to write high-performance, scalable web applications.

[0041] 5) NAPI (Node.js API): A set of C or C++ application programming interfaces (APIs) for developing Node.js plugins (or building Node.js extensions), which allows developers to write high-performance native modules in C or C++ to extend the functionality and performance of Node.js. NAPI provides a stable, cross-version standardized programming interface for interacting with the JavaScript language runtime in C or C++. Developers can create JavaScript objects, call JavaScript functions, handle JavaScript exceptions, and so on through NAPI. NAPI also provides some tools and functions for handling memory management, thread safety, and error handling, etc. NAPI allows developers to write plugins that are compatible with different versions of Node.js runtime.

[0042] 6) Front-end development: Front-end refers to the front part of a website, running on a computer, mobile, and other browsers to display web pages for users to browse. Front-end development refers to writing code for web pages or mobile application interfaces to implement user interaction functions.

[0043] 7) Server-side development: Server-side refers to a computer or server that provides services, accepts requests from clients, and provides corresponding services or resources according to requests. Server-side usually refers to software programs running on servers on the network, which can include data storage, business logic, database access, and other functions. For example, the server of a website is the server, which handles web page requests sent by clients and sends relevant web page content. Server-side development refers to writing server-side code to handle requests sent by clients (browsers, mobile devices, etc.).

[0044] In the related art, in the field of front-end development, JavaScript is the only language supported by the browser. Therefore, developers generally use JavaScript for front-end development, and Node.js is derived to provide a runtime environment for running JavaScript on the server side, allowing front-end developers to use Node.js to develop server-side applications. However, since many basic infrastructure in the field of server-side development is written in C++ or Rust and other more bottom-level languages, there is a lack of related basic service ecosystem in the Node.js field. If these services are rewritten using Node.js, it is a very large amount of work, resulting in low application development efficiency.

[0045] In addition, compared with directly running the underlying service in the underlying language, rewriting the underlying service using Node.js is also relatively low in running performance.

[0046] Based on the problems in the related art, the embodiments of the present application provide a data processing method, device, electronic device, computer readable storage medium and computer program product, which is a method for converting an object defined in a first programming language into a target structure defined in a second programming language in a scenario of calling an underlying service written in the second programming language in a server application written in the first programming language, which can improve the application development efficiency.

[0047] In the data processing method provided by the embodiments of the present application, first, in response to a calling request of a first application service to a second application service, object data constructed by using a first programming language is received, the object data including a plurality of attributes of an object and attribute values of each attribute, the first application service being implemented by using the first programming language and the second application service being implemented by using a second programming language; then, a first data type of each attribute value in the object data is obtained, and based on the first data type of each attribute value, a second data type corresponding to each attribute value in the second programming language is determined; and based on the object data and the first data type and the second data type of each attribute value, a target structure constructed by using the second programming language is determined; finally, the second application service is called based on the target structure. In this way, the second application service is called by using the first programming language, and it is no longer necessary to repeatedly write the second application service by using the first programming language, thereby improving the application development efficiency.

[0048] The following describes an exemplary application of the data processing device provided by the embodiments of the present application, which is an electronic device for converting an object constructed by using a first programming language into a target structure constructed by using a second programming language. The data processing device provided by the embodiments of the present application can be implemented as various types of terminals such as notebook computers, tablet computers, desktop computers, set-top boxes, smart phones, smart speakers, smart watches, smart televisions, vehicle-mounted terminals, etc., and can also be implemented as a server. The server can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms. The terminals and the server can be directly or indirectly connected through wired or wireless communication, which is not limited in the embodiments of the present application. The following describes an exemplary application when the data processing device is implemented as a server.

[0049] Referring to Figure 1, Figure 1 is a schematic diagram of an architecture of a data processing system provided by an embodiment of the present application. To implement a data processing application, the data processing application is used to convert an object built by a first programming language into a target structure built by a second programming language. The terminal of the embodiment of the present application is installed with at least the data processing application (which can be a module in the first application service). The data processing system 100 includes at least a terminal 400, a network 300 and a server 200, wherein the server 200 is a server of the data processing application. The server 200 can be a data processing device of the embodiment of the present application, i.e., the data processing method of the embodiment of the present application is implemented by the server 200. The terminal 400 is connected to the server 200 through the network 300, and the network 300 can be a wide area network or a local area network, or a combination of the two.

[0050] The terminal 400 runs a client corresponding to the first application service. The terminal 400 generates a call request for the second application service in response to an operation of calling the second application service, and sends the call request for the second application service to the server 200 through the network 300. After receiving the call request for the second application service, the server 200 receives object data built by the first programming language in response to the call request for the second application service by the first application service. The object data includes a plurality of attributes of the object and attribute values of each attribute. The first application service is implemented by the first programming language, and the second application service is implemented by the second programming language. Then, the server 200 obtains the first data type of each attribute value in the object data, and determines the second data type corresponding to each attribute value in the second programming language based on the first data type of each attribute value. The server 200 determines the target structure built by the second programming language based on the object data, and the first data type and the second data type of each attribute value. Finally, the server 200 calls the second application service based on the target structure. Meanwhile, the server 200 can also send the call result of the second application service to the terminal 400.

[0051] The data processing method provided in the embodiments of the present application can also be implemented based on a cloud platform and through cloud technology. For example, the server 200 can be a cloud server. The cloud server responds to a calling request of a first application service to a second application service, receives object data constructed by using a first programming language, the object data including a plurality of attributes of an object and attribute values of each attribute, the first application service being implemented by using the first programming language, and the second application service being implemented by using a second programming language. Alternatively, the cloud server obtains a first data type of each attribute value in the object data, and determines a second data type corresponding to each attribute value in the second programming language based on the first data type of each attribute value. Alternatively, the cloud server determines a target structure constructed by using the second programming language based on the object data and the first data type and the second data type of each attribute value. Alternatively, the cloud server calls the second application service based on the target structure.

[0052] In some embodiments, a cloud storage can also be provided, and the second data type corresponding to the first data type can be stored in the cloud storage. In this way, during the running of the data processing application, the second data type can be directly obtained from the cloud storage, thereby improving the construction efficiency of the target structure.

[0053] It should be noted that the cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and network in a wide area network or a local area network to realize the calculation, storage, processing, and sharing of data. The cloud technology is a general term of network technology, information technology, integration technology, management platform technology, and application technology applied based on a cloud computing business model, and can form a resource pool for on-demand use and flexible convenience. The cloud computing technology will become an important support. The background service of a technical network system needs a large amount of calculation and storage resources, such as a video website, a picture website, and more portals. With the high development and application of the Internet industry, in the future, each item can have its own identification mark and needs to be transmitted to a background system for logical processing. Different levels of data will be processed separately, and various types of industry data need strong system support, which can be realized through cloud computing.

[0054] Referring to Figure 2 , Figure 2 is a structural schematic diagram of an electronic device provided in the embodiments of the present application, Figure 2The illustrated electronic device includes at least one processor 410, memory 450, at least one network interface 420, and a user interface 430. The various components of the electronic device are coupled together by a bus system 440, which is configured to permit communication between the components. It is understood that the bus system 440 can include power busses, control busses, and status busses, in addition to data busses. For the sake of clarity, the various busses are illustrated in FIG. 4 as the bus system 440. The processor 410 can be an integrated circuit chip Figure 2 that has processing capabilities, such as a general purpose processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like. The processor 410 can be a microprocessor, or any conventional processor, etc.

[0055] The processor 410 can be an integrated circuit chip that has processing capabilities, such as a general purpose processor, a Digital Signal Processor (DSP), or other programmable logic device, discrete gate or transistor logic, discrete hardware components, or the like. The processor 410 can be a microprocessor, or any conventional processor, etc.

[0056] The user interface 430 includes one or more output devices 431 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 430 also includes one or more input devices 432 that facilitate user input, such as a keyboard, a mouse, a microphone, a touch screen display, a camera, other input buttons and controls, and the like.

[0057] The memory 450 can be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard drives, optical drives, and the like. The memory 450 optionally includes one or more storage devices remotely located from the processor 410.

[0058] The memory 450 includes volatile memory or nonvolatile memory, or both. Nonvolatile memory can be read only memory (ROM), volatile memory can be random access memory (RAM). The memory 450 described herein is intended to include any suitable type of memory.

[0059] In some embodiments, the memory 450 is capable of storing data to support various operations, examples of which include programs, modules, and data structures or subsets or superset thereof, which are described in the examples below.

[0060] The operating system 451 includes system programs for processing various basic system services and performing hardware-dependent tasks, such as a framework layer, a core library layer, a driver layer, and the like, for implementing various basic services and processing hardware-based tasks;

[0061] a network communication module 452 for communicating to other electronic devices via one or more (wired or wireless) network interfaces 420, exemplary network interfaces 420 including: Bluetooth, Wireless Fidelity (WiFi), and Universal Serial Bus (USB), etc.;

[0062] a presentation module 453 for enabling presentation of information via one or more output devices 431 (e.g., a display screen, a speaker, etc.) associated with the user interface 430 (e.g., a user interface for operating a peripheral device and displaying content and information);

[0063] an input processing module 454 for detecting and interpreting one or more user inputs or interactions from one or more input devices 432.

[0064] In some embodiments, the apparatus provided by the embodiments of the present application can be implemented in software, Figure 2 A data processing apparatus 455 stored in the memory 450 is shown, which can be software in the form of programs and plug-ins, etc., including the following software modules: a data receiving module 4551, a data type determining module 4552, a structure body determining module 4553, and a service calling module 4554. These modules are logical, and thus can be combined or further split according to the implemented functions. The functions of each module will be described below.

[0065] In some other embodiments, the apparatus provided by the embodiments of the present application can be implemented in hardware, as an example, the apparatus provided by the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the data processing method provided by the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can use one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Programmable Logic Devices (PLDs), Complex Programmable Logic Devices (CPLDs), Field-Programmable Gate Arrays (FPGAs), or other electronic elements.

[0066] It should be noted that the following examples of data processing methods are described in the context of calling a basic service written in C language or C++ in a JS environment. Based on the understanding of the following, those skilled in the art can also apply the data processing method provided in the embodiments of the present application to other scenarios that require conversion of programming language objects, such as scenarios of calling a basic service written in Rust in a JS environment.

[0067] Figure 3 is the first flowchart of the data processing method provided by the embodiments of the present application, which will be described below in conjunction with Figure 3 the steps shown in the figure, as Figure 3 shown, taking the server as an example of the execution subject of the information processing method, the method includes the following steps S101 to S104:

[0068] Step S101, in response to a call request of a first application service to a second application service, receiving object data constructed by a first programming language.

[0069] The object data includes a plurality of attributes of the object and attribute values of each attribute, the first application service is implemented by the first programming language, and the second application service is implemented by the second programming language.

[0070] Here, the first application service is a service in an application program developed and built by the first programming language. The second application service is a basic service or underlying service developed and built by the second programming language in the application program. The object is a specific instance in the first programming language, which is an entity used to describe objective things and is composed of a group of attributes and methods. Among them, the attribute is various characteristics (static) that the object has, and each attribute of each object has a specific attribute value. The method is an operation performed by the object. The object data is all data possessed by the object, which can include a plurality of attributes and attribute values of each attribute. The user triggers the operation of the first application service through the application program to generate a call request to the second application service. In response to the call request of the first application service to the second application service, the object data sent by the first application service can be received.

[0071] Exemplarily, the first programming language is JavaScript (JS) language, and an application A is developed by using the JS language, and the client interface and buttons of the application A are developed by using the JS language. The first application service can be a service in the client interface of the application A, for example, a login service. A user triggers the login service by inputting an account and a password into a login interface of the application A, and the login service sends object data constructed by the JS language. The object can be "login", and a plurality of attributes in the object data include the account and the password. The second programming language can be C language or C++, and the second application service is a basic login logic corresponding to the login service, that is, a data processing process of the account and the password, a judgment of whether the account and the password match, and a determination of a login result. The login result server sends a calling result of the second application service to the terminal.

[0072] In step S102, a first data type of each attribute value in the object data is acquired, and a second data type corresponding to each attribute value in the second programming language is determined based on the first data type of each attribute value.

[0073] Here, data types defined in different programming language environments are different. The first data type is a data type of an attribute value in the first programming language. For each attribute value, the second data type of the attribute value is a data type of the attribute value when the attribute value is written in the second programming language.

[0074] Exemplarily, the first programming language is JS language, and the first data type can include a number type (int, integer type), a double array type (doubleArray), an object type, a double type (doubleProps), a string type (string), a string array type (stringArray), a number array type (i32Array), and a Boolean type (boolTrue and boolFalse). The second programming language is C language or C++, and the second data type corresponding to the number type (int) and the number array type (i32Array) in the first data type is a number type (int), the second data type corresponding to the double array type (doubleArray) and the double type (doubleProps) in the first data type is a double precision floating point type (double), the second data type corresponding to the string type (string) and the string array type (stringArray) in the first data type is a character type (char), the second data type corresponding to the object type in the first data type is a structure pointer type, and the second data type corresponding to the Boolean type (boolTrue and boolFalse) in the first data type is a Boolean type (bool).

[0075] It should be noted that if the attribute value of an attribute is an object type, a call relationship is established between the object corresponding to the attribute and the attribute. For example, if the attribute parent exists in the object person, the attribute parent is used to call the object parent in the object person, and the attribute value of the attribute parent is the object data of the object parent. Similarly, the struct pointer type in the second data type also has the same effect, and will not be described again.

[0076] In step S103, a target struct constructed by using the second programming language is determined based on the object data and the first data type and the second data type of each attribute value.

[0077] Here, the struct is a collection of data composed of a series of data of the same type or different types, also known as a structure. The target struct is a struct obtained by converting the object in the first programming language into the second programming language. Taking the C language as an example, in the C language, the struct is a type of aggregate data type in the C language, and the struct can be declared as a variable, a pointer, or an array, etc., to realize a more complex data structure. The struct is also a collection of elements, which are called members of the struct. It should be noted that the members in the target struct are equivalent to the attributes of the object.

[0078] In some embodiments, referring to Figure 4 , Figure 4 It is shown that the determination of the target struct constructed by using the second programming language based on the object data and the first data type and the second data type of each attribute value in step S103 can be implemented through the following steps S1031 to S1033:

[0079] In step S1031, the object data is converted into a first object struct constructed by using a third programming language through a target programming interface.

[0080] Here, the target programming interface is an application programming interface (API) used for interaction between the second programming language and the first programming language runtime. The target programming interface can be used to create an object constructed by the first programming language, call a function of the first programming language, etc. The third programming language is a transit layer for converting the object constructed by the first programming language into the target struct constructed by the second programming language. The first object struct is a struct obtained by converting the object into the environment of the third programming language. For example, the third programming language can be the Rust language, and the target programming interface can be the NAPI (Node.js API).

[0081] In the embodiments of the present application, the object data corresponding object can be created by calling the napi_create_object function through the target programming interface, and a reference to the object is returned. The reference is encapsulated to obtain the first object structure JSobject. The third programming language can directly set or query each attribute in the object data of the object through the first object structure JSobject. For example, in response to a call request, the object data of the person object is received, the napi_create_object function in the NAPI interface is called to create the person object, and a reference to the person object is returned. The reference is encapsulated to obtain the first object structure JSobject corresponding to the person object.

[0082] In step S1032, the index data is constructed using the third programming language based on the first object structure and the first data type of each attribute value.

[0083] The index data includes a plurality of attributes, attribute values of each attribute, and a third data type corresponding to the first data type of each attribute value in the third programming language.

[0084] Here, the index data is a hash index composed of a mapping relationship between each attribute in the object data and the attribute value and the third data type corresponding to the attribute. For each attribute value, the third data type of the attribute value is the data type of the attribute value when the attribute value is written in the third programming language. The first object structure can be traversed to obtain the attribute value of each attribute in the first object structure. For each attribute, the third data type in the third programming language is determined according to the first data type of the attribute value of the attribute. Then, a mapping relationship between the attribute and the attribute value and the third data type is established. The mapping relationship between each attribute and the attribute value and the third data type is stored in the newly established hash index to obtain the index data.

[0085] In some embodiments, each first data type has a corresponding type identifier. Referring to Figure 5 , Figure 5 It is shown that the index data can be constructed using the third programming language based on the first object structure and the first data type of each attribute value in step S1032, which can be implemented by the following steps S10321 to S10324:

[0086] In step S10321, the attribute value of each attribute is obtained from the first object structure.

[0087] For example, the get_params_value_rs_struct function can be invoked to create an empty hash index. Then the get_params_value_rs_struct function obtains each attribute from the first object structure. For each attribute, the get_params_value_rs_struct function obtains the attribute value of the attribute from the first object structure.

[0088] In step S10322, a type identifier corresponding to the first data type of the attribute value is obtained.

[0089] Here, the type identifier is an identifier used to distinguish the object type and other first data types. The type identifier includes a first preset identifier and a second preset identifier. The first preset identifier is used to represent that the first data type of the attribute value is not the object type. Each first preset identifier corresponding to a first data type of a non-object type is different. The first preset identifier can be represented by a number, for example, the number 0 represents the Boolean type, 1 represents the string data type, and so on. The second preset identifier is used to represent that the first data type of the attribute value is the object type. The second preset identifier can be directly represented by the name of the object, for example, the first data type of the attribute parent is the object type, and the type identifier corresponding to the attribute value of the attribute parent is the second preset identifier "parent".

[0090] It should be noted that the correspondence between the first data type and the type identifier is defined in the environment of the first programming language before the application is developed. In the environment of the JS language, the non-object types such as the number type, the floating-point array type, the floating-point type, the string type, the string array type, the number array type, and the Boolean type can be defined as the corresponding first preset identifier Datatype, and the object type can be defined as the second preset identifier Parenttype. In the embodiment of the present application, the order of the steps of obtaining the attribute value and the type identifier from the first object structure by invoking the get_params_value_rs_struct function is not limited, and the type identifier can be obtained first, and then the attribute value.

[0091] In step S10323, based on the attribute value and the type identifier corresponding to the first data type of the attribute value, attribute data of the attribute is constructed by using the third programming language.

[0092] Here, the attribute data includes the attribute value of the attribute and the third data type of the attribute value. Each third data type also has a corresponding relationship with the type identifier. For each attribute, after the corresponding type identifier of the attribute value of the attribute is determined, the third data type of the attribute value can be determined based on the type identifier. The attribute value and the third data type of the attribute value together constitute the attribute data of the attribute.

[0093] In an embodiment of the present application, based on the attribute value and the type identifier corresponding to the first data type of the attribute value, the attribute data of the attribute can be constructed by using the third programming language in the following manner: first, when the type identifier corresponding to the first data type of the attribute value is a first preset identifier, a third data type in the third programming language corresponding to the first preset identifier is determined; and the attribute value and the third data type of the attribute value are determined as the attribute data of the attribute; or, when the type identifier corresponding to the first data type of the attribute value is a second preset identifier, a second object structure corresponding to the second preset identifier is obtained, and the attribute data of the attribute is determined based on the second object structure.

[0094] For example, the attribute value of the "age" attribute in the person object is 23, and the first data type of the attribute value is a number type (int), so the value of the first preset identifier corresponding to the attribute value is Datatype: 0; the attribute value of the "parent" attribute in the person object is the object data of the parent object, and the first data type of the attribute value is an object type, so the second preset identifier corresponding to the attribute value is parent. For the attribute in the first object structure, if the type identifier corresponding to the attribute is the first preset identifier Datatype: 0, the third data type corresponding to the first preset identifier Datatype: 0 can be directly determined as a number type (int). Based on the attribute value 23 and the number type (int), the attribute data of the "age" attribute is determined as int(23). If the type identifier corresponding to the attribute is the second preset identifier Parenttype: parent, the third data type corresponding to the second preset identifier Parenttype: parent can be directly determined as a structure pointer type. The second object structure constructed by the third programming language converted from the parent object is obtained, and the attribute data of each attribute in the parent object is determined based on the second object structure. The specific process of obtaining the second object structure can refer to the process of obtaining the first object structure, and will not be described here. The attribute data of each attribute in the parent object can also refer to the process of determining the attribute data of the attribute in the person object, and will not be described here.

[0095] In an embodiment of the present application, the type identifier corresponding to the first data type is pre-constructed, so the third data type of the first data type in the third programming language can be directly determined, the conversion efficiency of the data type is improved, and the application development efficiency is further improved.

[0096] In step S10324, the index data is determined based on the first object structure and the attribute data of each attribute.

[0097] Here, each attribute can be obtained from the first object structure, and a mapping relationship between each attribute and an attribute value and the third data type can be stored in a newly established hash index to obtain index data.

[0098] Since the first object structure is an abstract description of an object in the third programming language, and the method of operating the first object structure in the third programming language is too complex, the embodiment of the present application converts the first object structure into index data, facilitates subsequent operations on the code of the target structure converted by the third programming language, improves the conversion efficiency, and further improves the application development efficiency.

[0099] In the embodiment of the present application, the index data is determined based on the first object structure and the attribute data of each attribute, and can be implemented in the following manner: first, a plurality of attributes arranged in a first order are obtained from the first object structure, and the plurality of attributes are determined as a plurality of target keys; then, for each target key, the attribute data of the target key is determined as a target value having a mapping relationship with the target key; finally, each target key and the target value corresponding to each target key are stored in the first order to obtain the index data.

[0100] Here, the hash index is a structure for storing data in key-value, and the corresponding value can be found as long as the key to be searched is input. As a kind of hash index, the index data has a plurality of target keys and target values having a mapping relationship with each target key. The target key is the attribute, and the target value is the attribute data of the attribute. The first order is the storage order of the plurality of attributes in the first object structure, that is, the arrangement order of the plurality of attributes in the object data when the object is defined in the first programming language. The attributes can be obtained from the first object structure in the first order, and for each attribute, the attribute is taken as the target key, and the attribute data of the target key is determined as the target value having a mapping relationship with the target key. The target keys and target values of the plurality of attributes obtained in the first order are stored in the hash index in turn to obtain the index data.

[0101] For example, the target key in the index data IndexMap<String, RsArgsValue> is a String string, that is, the name of the attribute, and the target value is the attribute data RsArgsValue of the attribute. After a new hash index indexmap is created in the get_params_value_rs_struct function, the get_params_value_rs_struct function will insert the target key String and the target value RsArgsValue corresponding to the target key String in the hash index in the first order in turn to obtain the index data.

[0102] Since the first object structure is an abstract description of an object in the third programming language, and the method of operating the first object structure by the third programming language is too complex, the embodiment of the application converts the first object structure into index data, facilitates subsequent operation on the code of the target structure converted by the third programming language, improves the conversion efficiency, and further improves the application development efficiency.

[0103] In step S1033, the target structure constructed by the second programming language is determined based on the index data and the second data type of each attribute value.

[0104] The embodiment of the application converts the object into the first object structure constructed by the third programming language as a transit layer, and then determines the target structure constructed by the second programming language based on the index data of the first object structure, so as to convert the object in the first programming language into the target structure in the second programming language, and further realize the calling of the second application service by the first programming language, without repeatedly writing the second application service by the first programming language, thereby improving the application development efficiency. In addition, since the Rust language has advantages in memory safety, concurrency, performance, ecosystem, cross-platform support and the like, the Rust language can be selected as the third programming language. In terms of memory safety, the Rust language is a memory-safe programming language, which can capture memory errors at compile time through the ownership and borrowing system, can reduce potential memory safety problems, and can improve the reliability of the code; in terms of concurrency, the Rust language has built-in concurrency support, which can check thread safety at compile time through the ownership and borrowing system, so that it is easier and safer to write concurrent code; in terms of performance, the design of the Rust language without runtime overhead makes it possible to write high-performance extension interfaces while maintaining code readability and maintainability; in terms of the ecosystem, the Rust language can use various libraries and tools in the Rust language ecosystem to improve development efficiency and code quality; in terms of cross-platform support, the Rust language can run on multiple operating systems, so that the Rust language can easily build and deploy extension interfaces on different platforms. Therefore, the embodiment of the application uses the Rust language as a transit layer to convert the JS object into the C language structure, and then calls the service, which further improves the service running performance and security.

[0105] In some embodiments, referring to Figure 6 , Figure 6 The step S1033 of determining the target structure constructed by the second programming language based on the index data and the second data type of each attribute value can be implemented through the following steps S10331 to S10333:

[0106] In step S10331, the attribute value of each attribute and the third data type of the attribute value are obtained from the index data.

[0107] Here, the target structure built by the second programming language can be created in the environment of the third programming language according to the index data. When the target structure is created, memory needs to be allocated for the target structure, and the storage layout of the target structure in the memory needs to be calculated. The attribute value of each attribute and the third data type of each attribute value can be obtained from the index data first.

[0108] In step S10332, the memory address pointer corresponding to each attribute is determined based on the third data type of each attribute value.

[0109] Here, for each attribute, the memory address pointer corresponding to the attribute is the starting byte in the memory where the attribute value of the attribute is stored during the creation of the target structure. For example, if the memory address pointer of an attribute in the target structure in the memory is 128, the attribute is stored starting from the 128th byte in the memory. Based on the third data type of each attribute value, a corresponding memory address pointer in the memory can be allocated for each attribute value.

[0110] In the embodiment of the present application, based on the third data type of each attribute value, the memory address pointer corresponding to each attribute can be determined by the following method: first, based on the third data type of each attribute value, the memory space and the alignment data corresponding to each attribute are determined; the largest memory space among the memory spaces corresponding to the plurality of attributes is determined as the target alignment data; then, based on the target alignment data, the target initial address of the target structure in the memory is determined; finally, based on the target initial address and the memory space and the alignment data corresponding to each attribute, the memory address pointer corresponding to each attribute is determined.

[0111] Here, the memory space refers to the bytes occupied by the storage of the attribute value of the attribute in the memory. The alignment data refers to the memory address requirement when the attribute is stored in the memory, and the memory address pointer corresponding to the attribute must be an integer multiple of the alignment data of the attribute. The target alignment data refers to the memory address requirement when the target structure is stored in the memory, and the target initial address of the target structure in the memory must be an integer multiple of the target alignment data. The target initial address is the starting byte of the storage of the target structure in the memory. After the target initial address is obtained, each attribute is stored in the memory in turn based on the memory space and the alignment data corresponding to each attribute starting from the target initial address, and the memory address pointer corresponding to each attribute can be calculated.

[0112] For example, the memory space corresponding to the attribute value of the number type is 4 bytes, the memory space corresponding to the attribute value of the doubleArray type is 8 bytes, the memory space corresponding to the attribute value of the parent type is 8 bytes, the memory space corresponding to the attribute value of the doubleProps type is 8 bytes, the memory space corresponding to the attribute value of the string type is 8 bytes, the memory space corresponding to the attribute value of the stringArray type is 8 bytes, the memory space corresponding to the attribute value of the i32Array type is 8 bytes, and the memory space corresponding to the attribute value of the boolTrue and boolFalse types is 1 byte. The alignment data corresponding to each attribute can be equal to the target alignment data.

[0113] The embodiment of the application allocates the memory address pointer corresponding to each attribute to each attribute by using the memory space and the alignment data corresponding to each attribute, so that the target structure body constructed satisfies the memory storage requirement, and the memory address pointer is used to quickly locate the attribute when the target structure body is called subsequently, thereby improving the calling speed of the service.

[0114] In the embodiment of the application, the target initial address of the target structure body in the memory is determined based on the target alignment data, and the target initial address can be determined in the following manner: first, the initial address data of the target structure body allocated in the memory is obtained; when the initial address data is an integer multiple of the target alignment data, the initial address data is determined as the target initial address; then, when the initial address data is not an integer multiple of the target alignment data, the first padding data is obtained; the sum of the initial address data and the first padding data is an integer multiple of the target alignment data; finally, the sum of the initial address data and the first padding data is determined as the target initial address of the target structure body in the memory.

[0115] Here, the initial address data is the number of bytes of the starting position of the target structure body allocated in the memory by the function. For example, when the initial address data is 0 byte, the target structure body can start to be stored from the 0th byte. However, the memory alignment rule requires that the actual starting position of the target structure body must be an integer multiple of the target alignment data. Therefore, when the initial address data is not an integer multiple of the target alignment data, a first padding data can be calculated so that the sum of the initial address data and the first padding data is an integer multiple of the target alignment data, and the sum of the initial address data and the first padding data is determined as the target initial address of the target structure body in the memory.

[0116] For example, taking C or C++ as the second programming language, a memory alignment rule usually requires that the total memory space of a target structure is an integer multiple of the memory space of the largest member (i.e., attribute) in the target structure, and the largest member is an attribute whose second data type is a pointer or a double-precision floating-point number (double), and the memory space of the largest member is usually 8 bytes. Therefore, the total memory space of the target structure in the memory is an integer multiple of 8. The target initial address of the target structure must also be an integer multiple of 8. The alloc function can be used to allocate a block of memory for the target structure and obtain the initial address data of the target structure in the memory. If the initial address data is the 0th byte, the 0th byte is directly taken as the target initial address of the target structure, and the first attribute in the target structure is stored from the 0th byte. If the initial address data is the 1st byte, which is not an integer multiple of 8, it is determined that the first padding data is 7 bytes, the sum of the initial address data and the first padding data is 8 bytes, the 8th byte is taken as the target initial address of the target structure, and the first attribute in the target structure is stored from the 8th byte.

[0117] The embodiment of the present application determines the target initial address of the target structure based on the initial address data and the target alignment data, so that the first attribute in the target structure is stored from the target initial address, which meets the memory storage requirement and facilitates the use of the memory address pointer to quickly locate the attribute when the target structure is called subsequently, thereby improving the calling speed of the service.

[0118] In the embodiment of the present application, based on the target initial address and the memory space and alignment data corresponding to each attribute, the memory address pointer corresponding to each attribute is determined, which can be implemented in the following manner: first, for the ith attribute, the starting address pointer of the ith attribute is determined based on the memory address pointer of the (i-1)th attribute and the memory space; i is an integer greater than 1, and the starting address pointer of the first attribute is the target initial address; then, the second padding data of the ith attribute is determined based on the starting address pointer of the ith attribute and the alignment data; finally, the sum of the starting address pointer of the ith attribute and the second padding data is determined as the memory address pointer of the ith attribute.

[0119] For example, if the target initial address of the target structure is the 0th byte, for the 2nd attribute, assuming the 2nd attribute is name (then), the 1st attribute is age, the memory space of the 1st attribute is 4 bytes, and the memory address pointer is the 0th byte. The sum of the memory address pointer and the memory space is determined as the starting address pointer of the 2nd attribute, i.e., 0+4=4 bytes. The starting address pointer of the 2nd attribute is the 4th byte. The alignment data of the 2nd attribute is 8, but the 4th byte is not an integer multiple of 8. Therefore, the remainder obtained by dividing the starting address pointer of the 2nd attribute by the alignment data can be determined, and the difference between the alignment data and the remainder is determined as the second padding data of the 2nd attribute, i.e., 8-4%8=4. The second padding data of the 2nd attribute is 4 bytes, and the sum of the starting address pointer of the 2nd attribute and the second padding data, i.e., 4+4=8 bytes, is determined as the memory address pointer of the 2nd attribute.

[0120] The embodiments of the present application allocate the corresponding memory address pointer to each attribute according to the memory space and the alignment data corresponding to each attribute, so that the target structure constructed satisfies the memory storage requirement, and the memory address pointer is used to quickly locate the attribute when the target structure is called subsequently, thereby improving the calling speed of the service.

[0121] In step S10333, the plurality of attributes and the attribute value of each attribute are stored according to the memory address pointer corresponding to each attribute and the second data type of each attribute value, to obtain the target structure constructed by using the second programming language.

[0122] In the embodiments of the present application, for each attribute, after the corresponding memory address pointer of the attribute and the second data type of the attribute value of the attribute are determined, the attribute value can be stored in the memory at the position of the memory address pointer in the second data type.

[0123] In the embodiments of the present application, each attribute is stored based on the corresponding memory address pointer of each attribute, which facilitates the use of the memory address pointer to quickly locate the attribute when the target structure is called subsequently, thereby improving the calling speed of the service.

[0124] In some embodiments, the determination of the target structure constructed by using the second programming language based on the object data and the first data type and the second data type of each attribute value in step S103 can also be implemented in the following manner: first, for each attribute in the object data, the memory address pointer corresponding to the attribute is determined based on the first data type of the attribute value of the attribute. Then, the plurality of attributes and the attribute value of each attribute are stored according to the memory address pointer corresponding to each attribute and the second data type, to obtain the target structure constructed by using the second programming language.

[0125] In the embodiments of this application, the third programming language Rust language can not be used as a transit layer, and the memory address pointer of each attribute can be directly determined, and then each attribute is stored according to the memory address pointer and the second data type to obtain the target structure built by the second programming language (C language or C++). The process of obtaining the memory address pointer can refer to the embodiments of step S10332 described above, and will not be repeated here.

[0126] In step S104, the second application service is called based on the target structure.

[0127] Here, the storage location of each attribute in the memory can be determined based on the memory address pointer corresponding to each attribute in the target structure, and then when the second application service is called, the corresponding attribute and attribute value can be quickly queried, changed and the like based on the memory address pointer.

[0128] In the scenario where the first application service written in the first programming language calls the second application service written in the second programming language, the first data type of each attribute value in the object data built by the first programming language can be obtained, the second data type corresponding to the first data type in the second programming language can be determined, and the target structure can be built by the second programming language based on the object data and the first data type and the second data type of each attribute value, so as to realize the conversion of the object in the first programming language into the target structure in the second programming language. Since the target structure and the second application service are both implemented by the second programming language, the second application service can be directly called based on the target structure, and then the second application service is called through the first programming language, and it is not necessary to repeatedly write the second application service by using the first programming language, thereby reducing the workload required for application development, improving the application development efficiency, and at the same time, the application program implemented by the second programming language can be developed by using the first programming language, thereby improving the convenience of program development.

[0129] In the following, an exemplary application of the embodiments of this application in an actual application scenario will be described.

[0130] The embodiment of the application provides a data processing method, which is a method for converting a JS object defined in a JS environment into a C language or C++ structure (corresponding to the target structure in the above embodiment) in the scenario of calling a basic service written in the C language or C++ (corresponding to the second programming language in the above embodiment) in the JS (corresponding to the first programming language in the above embodiment) environment. For example, the JS environment is a user login interface in an application, the basic service written in the C language performs login logic for the user login interface, the JS object defined in the JS environment is composed of an account and a password, the basic service written in the C language needs to determine whether the account and the password match, and then determine a login result, but the C language cannot directly use the JS object, therefore, the data processing method provided in the embodiment of the application converts the account and the password data constructed by the JS language into the structure data constructed by the C language, so as to determine whether the account and the password match, and then determine the login result. Because the variable types in different programming languages are different on the memory model (which can be understood as a binary file compiled by the programming language), the variable type defined in one programming language cannot be directly converted into the memory model in another language environment. Therefore, the object defined by the JS language needs to be converted into the memory model of the structure in the C language. Because the bottom layer of Node.js is written in C++, developers can use C++ to write a native module through NAPI technology, and can call the native module in the Node.js environment.

[0131] In the embodiment of the application, the Rust language is used as a transfer layer, a native module (which can be understood as a binary file written in the Rust language, the JS object is converted into a C++ structure in the native module, and the corresponding C++ service is called through NAPI) written in the Rust language is used to call Node.js. After the incoming JS function is converted into a Rust function through the Rust language, the Rust function is converted into a C++ function and is transmitted to the C++ side for calling. The NAPI (corresponding to the target programming interface in the above embodiment) using the Rust language has the following advantages compared with the NAPI directly using C++:

[0132] Memory safety: Rust is a memory-safe programming language that uses ownership and borrowing systems to catch memory errors such as null pointer references, buffer overflows, etc. at compile time, reducing potential memory safety issues and improving code reliability. Concurrency: Rust has built-in concurrency support that uses ownership and borrowing systems to check thread safety at compile time, making it easier and safer to write concurrent code in Rust's NAPI. Performance: Rust is known for its excellent performance, providing execution efficiency comparable to C++. Rust's zero-cost abstraction and runtime-free design allow Rust's NAPI to write high-performance extensions while maintaining code readability and maintainability. Ecosystem: Rust's developer community is active and has a rich ecosystem. Rust's NAPI can leverage various libraries and tools in the Rust ecosystem to improve development efficiency and code quality. Cross-platform support: Rust has good cross-platform support and can run on multiple operating systems. This allows Rust's NAPI to easily build and deploy extensions on different platforms.

[0133] The data processing method provided by the embodiments of the present application is described in detail below.

[0134] First, define the JS-side object. The object data of the JS-side object includes multiple attributes of the object and attribute values of each attribute. The multiple attributes of the object can include all data types in the JS language (corresponding to the first data type in the above embodiment). For example, an object person can be defined, and the multiple attributes of the object person include age, attribute a, parent, attribute b, name, attribute c, attribute d, attribute e, and attribute f. The age is of a number type, the attribute a is of a doubleArray type, the parent is of an object type (used to establish a calling relationship with the parent object defined by JS), the attribute b is of a doubleProps type, the name is of a string type, the attribute c is of a stringArray type, the attribute d is of an i32Array type, the attribute e is of a boolTrue type, and the attribute f is of a boolFalse type.

[0135] Then, define the C language structure. Define a structure type (Struct) in the C language environment corresponding to the above JS object. In the C structure person in the C language environment, the type of each attribute (corresponding to the second data type in the above embodiment) corresponds one-to-one to the type of the JS object defined in the JS environment. For example, in the C language environment, age is of the number type (int), attribute a is of the double-precision floating-point number type (double), parent is of the structure pointer type, attribute b is of the double-precision floating-point number type, name is of the character type (char), attribute c is of the character type, attribute d is of the number type, and attributes e and f are of the Boolean type (bool).

[0136] Next, compile the C++ code into a dynamic link library. After compiling the written C++ code into a dynamic link library, use the Rust language (corresponding to the third programming language in the above embodiment) to call the dynamic link library.

[0137] Then, convert the object in the JS environment into a data type in the Rust environment. In the embodiment of the application, the Rust language is used as a bridge for interaction between the JS and C environments. Therefore, it is necessary to first convert the object in the JS environment into a data type (corresponding to the third data type in the above embodiment) in the Rust environment, and then convert the data type in the Rust environment into a structure in the C language environment. The Rust environment provides a JSobject data type as an encapsulation of all objects in the JS environment. The JSobject data type is an encapsulation of a JavaScript object in NAPI, and an instance of the JSobject data type is actually a reference to a JavaScript object. At the bottom layer, a JSobject data type (corresponding to the first object structure in the above embodiment) can be created by using the napi_create_object function, which creates a new object on the JavaScript heap and returns a reference to the object, and the reference is encapsulated in the JSobject data type, so that the Rust code can safely operate the object. For example, the Rust language creates a person object by calling the napi_create_object function in the NAPI interface, and returns a reference to the person object.

[0138] In NAPI-RS (a third-party library of Rust language), the underlying implementation of JSobject data type is in the value module of napi crate. The module defines an Object struct, which represents a JavaScript object. The Object struct contains two fields: a value field and an env field. The value field is a napi_value, which is a type in NAPI, representing a JavaScript value. For example, the Value field is binary data containing all the object data of the person object. The env field is a napi_env, which represents the current NAPI environment, i.e., the execution environment of the code. The Object struct can be operated by calling NAPI functions. For example, the process of setting the attribute value of the name attribute in the person object in Rust language by calling the set_named_property function of NAPI is as follows: a key K (the name attribute) and a value V (the attribute value Tom of the name attribute) are received, and then the set_named_property function is called to receive the current NAPI environment, the object data (napi_value) of the person object, the set attribute name, and the set attribute value (e.g., LiLi). If the set_named_property function is executed successfully, napi_ok is returned, indicating that the attribute value of the name attribute has been changed from Tom to LiLi; otherwise, an error code is returned. During the execution of the set_named_property function, the check_status! macro checks the return value of the function. If it is not napi_ok, it returns an Error. Similarly, the get_named_property function can be used to get the attribute of the object. The JSobject data type of NAPI-RS is implemented by calling NAPI functions, which provide the ability to operate JavaScript objects.

[0139] Then, the JSobject data type is converted into an indexmap in the Rust environment (a data type in the Rust language, corresponding to the index data in the above embodiment). Since the JSobject data type is an abstract description of a JS object by the Rust environment, the operation of the JSobject data type is too complex. In order to facilitate the operation on the subsequent code, the JSobject data type is converted into the indexmap data type which is easier to operate. In order to know how to convert the data in the a environment into the data in the b environment during the code execution, the data type of the currently processed data needs to be known. For example, when the age attribute is processed, it needs to be known that the age attribute is a number type, so that the correct code can be used to process the data conversion operation. The data type of each attribute of the object can be defined on the JS side, and sent to the rust side. Here, the number type, the floating point array type, the floating point type, the string type, the string array type, the number array type, the Boolean type, etc. can be defined as Datatype (corresponding to the first preset identifier in the above embodiment), and the object type (parent) can be defined as Parenttype (corresponding to the second preset identifier in the above embodiment). Datatype can be represented by a number (Number). Different data types of Datatype are represented by different numbers. For example, the number 1 represents the string type, the number 0 represents the number type, etc. For example, the age attribute can be defined as an i32 type number, i.e. a 32-bit signed number (age: Datatype.I32); the attribute a is defined as a floating point array type and the length of the array (a: type: Datatype.doubleArray, length: person.doubleArray.length). The parent attribute is defined as an object type (parent: Parenttype).

[0140] The data type information is passed from the JS environment to the Rust environment, and when the Rust environment is traversing the properties of the JSobject data type, it can determine the code logic for processing the current property and property value when it processes the property type of the current property. An RsArgsValue enumeration type (corresponding to the property data in the above embodiment) is defined to represent common JS object data types in the Rust environment. Each line in the RsArgsValue enumeration type stores a property, which is consistent with the JS side, and the property value is stored in the () after the property. For example, in the RsArgsValue enumeration type, I32(i32) represents the I32 data type and the property value i32. After obtaining the RsArgsValue enumeration type, an indexmap data type of IndexMap<String, RsArgsValue> can be defined, where the String string is the name of the property, such as age, and the RsArgsValue is the data type and property value of the property, which represents a map structure with a key type of string and a value type of RsArgsValue. The JSobject data type can be converted to the indexmap data type which is easier to operate using a function in Rust. For example, the get_params_value_rs_struct function can be used to convert the value of the JavaScript object to the Rust structure. The function receives two parameters, each of which is a reference to the JSobject data type. The two parameters are params_type_object (the data type of each property in the object) and params_value_object (each property and the property value of each property in the object). The get_params_value_rs_struct function finally returns an indexmap data type, where the key is a String type string and the value is an RsArgsValue enumeration type. The indexmap data type is a hash map that maintains the insertion order. The specific execution process of the get_params_value_rs_struct function is described below.

[0141] The get_params_value_rs_struct function first creates a new indexmap data type, then gets all the keys of the params_value_object, and iterates over each key (i.e., gets all the attributes in the object person and iterates over each attribute). For each key, the get_params_value_rs_struct function first gets the corresponding data type from the params_type_object, then processes it differently according to the data type. If the data type is ValueType::Number (e.g., 0 represents the I32 data type, 1 represents the string data type, etc.), the function converts it to the DataType enum type and processes it differently according to the different values of DataType. For example, if DataType represents the string type String, the function gets the corresponding attribute value from the params_value_object and converts it to the string type String, then inserts it into the indexmap data type as RsArgsValue::String. The processing of other DataTypes is similar. If the type is ValueType::Object (e.g., parent), the function recursively calls itself to process the nested object and inserts the result into the indexmap data type as RsArgsValue::Object. If the data type is neither ValueType::Number nor ValueType::Object, the function triggers a panic because it can only handle the two types mentioned above. Finally, the get_params_value_rs_struct function returns the indexmap data type filled with data. The main function of get_params_value_rs_struct is to convert the value of the JavaScript object into a Rust structure so that it can be used in Rust code.

[0142] Finally, the C language structure is dynamically created in Rust according to the indexmap data type. In the embodiment of the application, pointer operation is used to operate data types between different programming languages. The write_object_data function can be used to receive the indexmap data type parameter map (object attribute value and data type) and return a * mut c_void type pointer. The * mut c_void type pointer is used to represent the memory address of the C language structure in the memory, and the C language structure can be accessed through the pointer. The function of the write_object_data function is to write the indexmap data type into a continuous memory. The calculate_layout function can be used to calculate the memory size and alignment required by the data in the map, and then a Layout object is created using the information, and the Layout object describes the layout of the memory. For each attribute, the memory address of the attribute in the memory must be an integer multiple of the alignment of the attribute.

[0143] Taking the person structure obtained by converting the person object as an example, the memory size occupied by the person structure needs to be calculated, and the memory size is equal to the sum of the sizes of all attributes in the person structure plus the size of the additional padding. On a 64-bit platform, considering the memory alignment rule, the size of the person structure may be different. The memory alignment rule usually requires that the size of the structure be an integer multiple of the size of the largest member. In the person structure, the largest member is the pointer and the double data type, and their sizes are usually 8 bytes. The following are the members of the structure and their sizes: age (int): 4 bytes, doubleArray (double pointer): 8 bytes, parent (Person pointer): 8 bytes, doubleProps (double): 8 bytes, name (char pointer): 8 bytes, stringArray (char pointer pointer): 8 bytes, i32Array (int pointer): 8 bytes, boolTrue (bool): 1 byte, boolFalse (bool): 1 byte. Considering memory alignment, there may be 4 bytes of padding after age, and 6 bytes of padding after boolTrue and boolFalse. Therefore, the total size of the person structure may be: 4 (age) + 4 (padding) + 8 (doubleArray) + 8 (parent) + 8 (doubleProps) + 8 (name) + 8 (stringArray) + 8 (i32Array) + 1 (boolTrue) + 1 (boolFalse) + 6 (padding) = 64 bytes. Figure 7is a schematic diagram of a description relationship of a person structure in memory provided by an embodiment of the present application. Assuming that an initial address of the person structure in memory is 0, a size of an age (age) attribute is 4 bytes, 4 bytes of padding data are needed, and an attribute a (doubleArray) is stored at a memory address of 8 bytes. A size of the attribute a is 8 bytes, and the like. A memory address of a parent (parent) attribute is 16, a memory address of an attribute b (doubleProps) is 24, a memory address of a name (name) attribute is 32, a memory address of an attribute c (stringArray) is 40, a memory address of an attribute d (i32Array) is 48, a memory address of an attribute e (boolTrue) is 56, a memory address of an attribute f (boolFalse) is 57, and finally, padding data is filled to a memory address of 64.

[0144] In some embodiments, a size of the padding data is calculated in the following manner: padding = (align - (offset % align)) % align. Wherein, the padding is a byte of the padding data, the align is an alignment of a current field (attribute), and the offset is a size of data already written in the current memory. In order to satisfy the rule that a write address of a field must be a multiple of an alignment requirement of the field, it is needed to make the offset + padding a multiple of the align, so that a next field can be written starting at a position satisfying the alignment. Specifically, the offset % align calculates a remainder of the offset divided by the align, and the align - (offset % align) calculates a distance of the offset to a next multiple of the align. Then, the distance is taken modulo. If the offset is already a multiple of the align, the padding is 0. For example, assuming that 10 bytes of data have been written in the memory, and a field of 8 bytes of alignment is to be written. Then, the offset is 10, the align is 8, the offset % align is 2, the align - (offset % align) is 6, and the padding is 6. That is, 6 bytes of padding data are needed to be added after the current memory position, and the next field is written starting at a position of 16 bytes. In this way, the next field satisfies the requirement of 8 bytes of alignment. Because 16 is a multiple of 8.

[0145] A block of memory can be allocated using the alloc function according to the memory layout calculated above, and a pointer ptr of the block of memory is obtained. Then, the alloc function creates a field_ptr pointer for writing data in the memory. The write_object_data function then iterates through each field in the map. For each field, the function first calculates the required alignment, and adjusts the position of the field_ptr pointer according to the alignment. Taking the number type as an example, the pointer is moved to the start address of the layout, and it is calculated whether the current address conforms to the memory alignment of the number type variable. If it conforms, the number type data is written to the current memory address. If it does not conform, the pointer is moved to the memory address that conforms to the requirement. After writing the number type data, the pointer is moved by the memory size occupied by the number type data.

[0146] The write_object_data function processes different types of fields. For example, if the data type of the field is RsArgsValue::String, the write_object_data function creates a CString object and writes the pointer of the CString object into the memory. If the type of the field is RsArgsValue::StringArray, the write_object_data function creates a Vec<*const c_char> object and writes the pointer of the Vec<*const c_char> object into the memory. The processing of other types is similar. Finally, the write_object_data function returns a pointer to the allocated memory. The main function of this function is to write the data in the indexmap data type into a continuous memory, so that the data can be passed to the C language code. This is because Rust language and C language have different memory layouts, so such conversion is needed. After writing the data, the write_object_data function updates the offset variable, so that the alignment can be correctly calculated in the next iteration. Finally, the embodiment of the application uses Rust language as a transit station to realize the conversion process of JS objects to C language structures.

[0147] The embodiment of the application selects Rust language as a transit layer to convert JS objects into structures in C language, so that developers can prepare the data structure required by the method of the C environment in the JS environment without additional Rust code or C code, so that front-end developers can better participate in the system development of the back-end application, and the application development efficiency is improved. In addition, using Rust language as a transit layer also improves the service running performance.

[0148] It can be understood that, in the embodiments of the present application, related data such as user information is involved, and when the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of countries and regions.

[0149] The following continues to illustrate an exemplary structure of the implementation of the data processing apparatus 455 provided by the embodiments of the present application as a software module. In some embodiments, as shown in Figure 2 The software module stored in the data processing apparatus 455 of the memory 450 can include: a data receiving module 4551, configured to receive object data constructed by using a first programming language in response to a calling request of a first application service to a second application service, the object data including a plurality of attributes of an object and attribute values of each attribute, the first application service being implemented by using the first programming language, and the second application service being implemented by using a second programming language; a data type determining module 4552, configured to obtain a first data type of each attribute value in the object data, and determine a second data type corresponding to each attribute value in the second programming language based on the first data type of each attribute value; a structure body determining module 4553, configured to determine a target structure body constructed by using the second programming language based on the object data and the first data type and the second data type of each attribute value; and a service calling module 4554, configured to call the second application service based on the target structure body.

[0150] In some embodiments, the structure body determining module 4553 is further configured to, for each attribute in the object data, determine a memory address pointer corresponding to the attribute based on the first data type of the attribute value of the attribute; and store the plurality of attributes and the attribute values of each attribute according to the memory address pointer and the second data type corresponding to each attribute, to obtain the target structure body constructed by using the second programming language.

[0151] In some embodiments, the structure body determining module 4553 is further configured to convert the object data into a first object structure body constructed by using a third programming language through a target programming interface; construct index data by using the third programming language based on the first object structure body and the first data type of each attribute value; the index data including the plurality of attributes, the attribute values of each attribute, and a third data type corresponding to the first data type of each attribute value in the third programming language; and determine the target structure body constructed by using the second programming language based on the index data and the second data type of each attribute value.

[0152] In some embodiments, each first data type has a corresponding type identifier; the structure determining module 4553 is further configured to, for each attribute, obtain an attribute value of the attribute from the first object structure; obtain a type identifier corresponding to a first data type of the attribute value; construct attribute data of the attribute by using the third programming language based on the attribute value and the type identifier corresponding to the first data type of the attribute value; and determine the index data based on the first object structure and the attribute data of each attribute.

[0153] In some embodiments, the structure determining module 4553 is further configured to, when the type identifier corresponding to the first data type of the attribute value is a first preset identifier, determine a third data type in the third programming language corresponding to the first preset identifier; determine the attribute value and the third data type of the attribute value as the attribute data of the attribute; and when the type identifier corresponding to the first data type of the attribute value is a second preset identifier, obtain a second object structure corresponding to the second preset identifier, and determine the attribute data of the attribute based on the second object structure.

[0154] In some embodiments, the structure determining module 4553 is further configured to obtain a plurality of attributes arranged in a first order from the first object structure, and determine the plurality of attributes as a plurality of target keys; for each target key, determine attribute data of the target key as a target value having a mapping relationship with the target key; and store each target key and the target value corresponding to each target key in the first order to obtain the index data.

[0155] In some embodiments, the structure determining module 4553 is further configured to, for each attribute, obtain an attribute value of the attribute and a third data type of the attribute value from the index data; determine a memory address pointer corresponding to each attribute based on the third data type of each attribute value; and store the plurality of attributes and the attribute value of each attribute according to the memory address pointer corresponding to each attribute and the second data type of each attribute value to obtain a target structure constructed by using the second programming language.

[0156] In some embodiments, the structure determining module 4553 is further configured to determine a memory space corresponding to each attribute and alignment data based on the third data type of each attribute value; determine a target alignment data as a largest memory space among the memory spaces corresponding to the plurality of attributes; determine a target initial address of the target structure in the memory based on the target alignment data; and determine the memory address pointer corresponding to each attribute based on the target initial address and the memory space corresponding to each attribute and the alignment data.

[0157] In some embodiments, the structure determining module 4553 is further configured to obtain initial address data of the target structure allocated in the memory; when the initial address data is an integer multiple of the target alignment data, determine the initial address data as the target initial address; when the initial address data is not an integer multiple of the target alignment data, obtain first padding data; the sum of the initial address data and the first padding data is an integer multiple of the target alignment data; and determine the sum of the initial address data and the first padding data as the target initial address of the target structure in the memory.

[0158] In some embodiments, the structure determining module 4553 is further configured to, for the i-th attribute, determine a start address pointer of the i-th attribute based on a memory address pointer of an (i-1)-th attribute and the memory space; i is an integer greater than 1, and the start address pointer of the first attribute is the target initial address; determine second padding data of the i-th attribute based on the start address pointer of the i-th attribute and the alignment data; and determine the sum of the start address pointer of the i-th attribute and the second padding data as the memory address pointer of the i-th attribute.

[0159] Embodiments of the present application provide a computer program product, which includes a computer program or computer executable instructions stored in a computer readable storage medium. A processor of an electronic device reads the computer executable instructions from the computer readable storage medium, and the processor executes the computer executable instructions to cause the electronic device to perform the data processing method provided by the embodiments of the present application.

[0160] Embodiments of the present application provide a computer readable storage medium, which stores computer executable instructions or computer programs. When the computer executable instructions or computer programs are executed by a processor, the processor will perform the data processing method provided by the embodiments of the present application, for example, the data processing method shown in the following. Figure 3

[0161] In some embodiments, the computer readable storage medium can be RAM, ROM, flash memory, magnetic surface memory, optical disc, or CD-ROM, etc. storage; or can be various devices including one or any combination of the above storage.

[0162] In some embodiments, the computer executable instructions can be in the form of programs, software, software modules, scripts or codes, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and can be deployed in any form, including being deployed as independent programs or being deployed as modules, components, subroutines or other units suitable for use in a computing environment.

[0163] ​By way of example, computer-executable instructions can include but are not limited to: a procedure, a function, a subprogram, a program, a routine, a subroutine, a component, a module, a software package, a class, or any combination of instructions, data structures, or program statements. A control system can generally be, without limitation, a processor, a hard-wired circuit, an electronic or other hardware component, digital or analog combinatorial logic, an analog circuit having multiple transistors, a pipeline, or a plurality of coupled components.

[0164] By way of example, computer-executable instructions can be deployed to be executed on one electronic device or on multiple electronic devices that are located at one site or distributed across multiple sites and interconnected by a communication network.

[0165] In summary, through the embodiments of the present application, the developer can prepare the data structure required by the method of the C environment in the JS environment without additional programming of the Rust code or the C code, so that the front-end developer can better participate in the system development of the back-end application, and the application development efficiency is improved.

[0166] The above merely illustrates the embodiments of the present application, and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, and improvement within the spirit and scope of the present application shall be included in the protection scope of the present application.

Claims

1. A data processing method, characterized by, The method comprises: in response to a call request of a first application service to a second application service, receiving object data constructed using a first programming language, the object data comprising a plurality of attributes of an object and attribute values of each of the attributes, the first application service being implemented using the first programming language, and the second application service being implemented using a second programming language; obtaining a first data type of each of the attribute values in the object data, and determining a second data type corresponding to each of the attribute values in the second programming language based on the first data type of each of the attribute values; determining a target structure constructed using the second programming language based on the object data, and the first data type and the second data type of each of the attribute values; calling the second application service based on the target structure.

2. The method of claim 1, wherein, The determining of the target structure constructed using the second programming language based on the object data, and the first data type and the second data type of each of the attribute values comprises: for each of the attributes in the object data, determining a memory address pointer corresponding to the attribute based on the first data type of the attribute value of the attribute; storing the plurality of attributes and the attribute values of each of the attributes according to the memory address pointer and the second data type corresponding to each of the attributes, to obtain the target structure constructed using the second programming language.

3. The method of claim 1, wherein, The determining of the target structure constructed using the second programming language based on the object data, and the first data type and the second data type of each of the attribute values comprises: converting the object data into a first object structure constructed using a third programming language through a target programming interface; constructing index data using the third programming language based on the first object structure and the first data type of each of the attribute values; the index data comprising the plurality of attributes, the attribute values of each of the attributes, and a third data type corresponding to the first data type of each of the attribute values in the third programming language; determining the target structure constructed using the second programming language based on the index data and the second data type of each of the attribute values.

4. The method of claim 3, wherein, Each of the first data types has a corresponding type identifier; The constructing of the index data using the third programming language based on the first object structure and the first data type of each of the attribute values comprises: for each of the attributes, obtaining the attribute value of the attribute from the first object structure; obtaining a type identifier corresponding to the first data type of the attribute value; constructing attribute data of the attribute using the third programming language based on the attribute value and the type identifier corresponding to the first data type of the attribute value; determining the index data based on the first object structure and the attribute data of each of the attributes.

5. The method of claim 4, wherein, The constructing of the attribute data of the attribute using the third programming language based on the attribute value and the type identifier corresponding to the first data type of the attribute value comprises: when the type identifier corresponding to the first data type of the attribute value is a first preset identifier, determining a third data type in the third programming language corresponding to the first preset identifier; determining attribute data of the attribute based on the attribute value and the third data type of the attribute value; when the type identifier corresponding to the first data type of the attribute value is a second preset identifier, obtaining a second object structure corresponding to the second preset identifier, and determining attribute data of the attribute based on the second object structure.

6. The method of claim 4, wherein, The determination of the index data based on the first object structure and the attribute data of each attribute includes: obtaining a plurality of attributes arranged in a first order from the first object structure, and determining the plurality of attributes as a plurality of target keys; for each target key, determining the attribute data of the target key as a target value having a mapping relationship with the target key; storing each target key and the target value corresponding to each target key in the first order to obtain the index data.

7. The method of claim 3, wherein, The determination of the target structure constructed by using the second programming language based on the index data and the second data type of each attribute value includes: for each attribute, obtaining the attribute value of the attribute and the third data type of the attribute value from the index data; determining a memory address pointer corresponding to each attribute based on the third data type of each attribute value; storing the plurality of attributes and the attribute value of each attribute according to the memory address pointer corresponding to each attribute and the second data type of each attribute value to obtain the target structure constructed by using the second programming language.

8. The method of claim 7, wherein, The determination of the memory address pointer corresponding to each attribute based on the third data type of each attribute value includes: determining a memory space and alignment data corresponding to each attribute based on the third data type of each attribute value; determining a target alignment data as the largest memory space in the memory space corresponding to the plurality of attributes; determining a target initial address of the target structure in the memory based on the target alignment data; determining a memory address pointer corresponding to each attribute based on the target initial address and the memory space and alignment data corresponding to each attribute.

9. The method of claim 8, wherein, The determination of the target initial address of the target structure in the memory based on the target alignment data includes: obtaining initial address data of the target structure allocated in the memory; when the initial address data is an integer multiple of the target alignment data, determining the initial address data as the target initial address; when the initial address data is not an integer multiple of the target alignment data, obtaining first padding data; the sum of the initial address data and the first padding data is an integer multiple of the target alignment data; determining the sum of the initial address data and the first padding data as the target initial address of the target structure in the memory.

10. The method of claim 8, wherein, The determination of the memory address pointer corresponding to each attribute based on the target initial address and the memory space and alignment data corresponding to each attribute includes: For the i-th attribute, a start address pointer of the i-th attribute is determined based on a memory address pointer of an (i-1)-th attribute and a memory space, i is an integer greater than 1, and a start address pointer of a first attribute is the target initial address; Second padding data of the i-th attribute is determined based on the start address pointer of the i-th attribute and alignment data; A sum of the start address pointer of the i-th attribute and the second padding data is determined as a memory address pointer of the i-th attribute.

11. A data processing apparatus, characterized by The apparatus comprises: A data receiving module is configured to receive object data constructed by using a first programming language in response to a calling request of a first application service to a second application service, the object data including a plurality of attributes of an object and attribute values of each of the attributes, the first application service being implemented by using the first programming language, and the second application service being implemented by using a second programming language; A data type determining module is configured to obtain a first data type of each of the attribute values in the object data, and determine a second data type corresponding to each of the attribute values in the second programming language based on the first data type of each of the attribute values; A structure body determining module is configured to determine a target structure body constructed by using the second programming language based on the object data and the first data type and the second data type of each of the attribute values; A service calling module is configured to call the second application service based on the target structure body.

12. An electronic device, comprising: The electronic device comprises: A memory is configured to store computer executable instructions or computer programs; A processor is configured to execute the computer executable instructions or computer programs stored in the memory to implement the data processing method in any one of claims 1 to 10.

13. A computer-readable storage medium storing computer-executable instructions or a computer program, wherein the computer-executable instructions or the computer program comprise the steps of: The computer executable instructions or computer programs are executed by the processor to implement the data processing method in any one of claims 1 to 10. ​ 14. A computer program product comprising computer-executable instructions or a computer program, characterized in that, The computer executable instructions or computer programs are executed by the processor to implement the data processing method in any one of claims 1 to 10. The computer executable instructions or computer programs are executed by the processor to implement the data processing method in any one of claims 1 to 10.