In this paper, we consider minimal linear codes by a general construction of from q-ary functions. First, give necessary and sufficient conditions for codewords which are constructed functions to be minimal. Second, as applications, present three constructions codes. Constructions on in paper generalize some recent results Ding et al. (IEEE Trans. Inf. Theory 64(10), 6536–6545, 2018); Heng (Fin...