%%%------------------------------------------------------------------- %%% @author anlicheng %%% @copyright (C) 2025, %%% @doc %%% %%% @end %%% Created : 06. 5月 2025 10:32 %%%------------------------------------------------------------------- -module(id_generator_model). -author("anlicheng"). -include("efka_tables.hrl"). %% API -export([create_table/0, next_id/1]). create_table() -> %% id生成器 {atomic, ok} = mnesia:create_table(id_generator, [ {attributes, record_info(fields, id_generator)}, {record_name, id_generator}, {disc_copies, [node()]}, {type, ordered_set} ]). next_id(Tab) when is_atom(Tab) -> mnesia:dirty_update_counter(id_generator, Tab, 1).